Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd88372a

Browse files
committed
Add test for Windows env var upcasing regression
1 parent11839ab commitd88372a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

‎test/test_git.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
importsubprocess
1111
importsys
1212
fromtempfileimportTemporaryDirectory,TemporaryFile
13-
fromunittestimportmock
13+
fromunittestimportmock,skipUnless
1414

1515
fromgitimportGit,refresh,GitCommandError,GitCommandNotFound,Repo,cmd
1616
fromtest.libimportTestBase,fixture_path
@@ -105,6 +105,27 @@ def test_it_executes_git_not_from_cwd(self):
105105
with_chdir(tmpdir):
106106
self.assertRegex(self.git.execute(["git","version"]),r"^git version\b")
107107

108+
@skipUnless(is_win,"The regression only affected Windows, and this test logic is OS-specific.")
109+
deftest_it_avoids_upcasing_unrelated_environment_variable_names(self):
110+
old_name="28f425ca_d5d8_4257_b013_8d63166c8158"
111+
ifold_name==old_name.upper():
112+
raiseRuntimeError("test bug or strange locale: old_name invariant under upcasing")
113+
os.putenv(old_name,"1")# It has to be done this lower-level way to set it lower-case.
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))",
123+
]
124+
cmdline= [sys.executable,"-c","\n".join(script_lines)]
125+
pair_text=subprocess.check_output(cmdline,shell=False,text=True)
126+
new_name=pair_text.split("=")[0]
127+
self.assertEqual(new_name,old_name)
128+
108129
deftest_it_accepts_stdin(self):
109130
filename=fixture_path("cat_file_blob")
110131
withopen(filename,"r")asfh:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp