| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d88372a commit 7296e5c
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,13 @@ | |||
| 1 | + import subprocess | ||
| 2 | + import sys | ||
| 3 | + | ||
| 4 | + import git | ||
| 5 | + | ||
| 6 | + | ||
| 7 | + _, working_dir, env_var_name = sys.argv | ||
| 8 | + | ||
| 9 | + # Importing git should be enough, but this really makes sure Git.execute is called. | ||
| 10 | + repo = git.Repo(working_dir) # Hold the reference. | ||
| 11 | + git.Git(repo.working_dir).execute(["git", "version"]) | ||
| 12 | + | ||
| 13 | + print(subprocess.check_output(["set", env_var_name], shell=True, text=True)) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -112,16 +112,12 @@ def test_it_avoids_upcasing_unrelated_environment_variable_names(self): | |||
| 112 | 112 | raise RuntimeError("test bug or strange locale: old_name invariant under upcasing") | |
| 113 | 113 | os.putenv(old_name, "1") # It has to be done this lower-level way to set it lower-case. | |
| 114 | 114 | ||
| 115 | - script_lines = [ | ||
| 116 | - "import subprocess, git", | ||
| 117 | - | ||
| 118 | - # Importing git should be enough, but this really makes sure Git.execute is called. | ||
| 119 | - f"repo = git.Repo({self.rorepo.working_dir!r})", | ||
| 120 | - "git.Git(repo.working_dir).execute(['git', 'version'])", | ||
| 121 | - | ||
| 122 | - f"print(subprocess.check_output(['set', {old_name!r}], shell=True, text=True))", | ||
| 115 | + cmdline = [ | ||
| 116 | + sys.executable, | ||
| 117 | + fixture_path("env_case.py"), | ||
| 118 | + self.rorepo.working_dir, | ||
| 119 | + old_name, | ||
| 123 | 120 | ] | |
| 124 | - cmdline = [sys.executable, "-c", "\n".join(script_lines)] | ||
| 125 | 121 | pair_text = subprocess.check_output(cmdline, shell=False, text=True) | |
| 126 | 122 | new_name = pair_text.split("=")[0] | |
| 127 | 123 | self.assertEqual(new_name, old_name) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments