Skip to content

Instantly share code, notes, and snippets.

@EliahKagan
Created September 7, 2023 12:53
Show Gist options
  • Save EliahKagan/21916264b96b302e13fd105f5ba2aae6 to your computer and use it in GitHub Desktop.
Save EliahKagan/21916264b96b302e13fd105f5ba2aae6 to your computer and use it in GitHub Desktop.
(.venv) C:\Users\ek\source\repos\GitPython [envcase-next ≡]> pytest --no-cov -k 'test_it_executes_git_not_from_cwd or test_it_avoids_upcasing_unrelated_environment_variable_names'
Test session starts (platform: win32, Python 3.11.5, pytest 7.4.1, pytest-sugar 0.9.7)
rootdir: C:\Users\ek\source\repos\GitPython
configfile: pyproject.toml
testpaths: test
plugins: cov-4.1.0, sugar-0.9.7
collected 503 items / 501 deselected / 2 selected
―――――――――――――――――――――――― TestGit.test_it_avoids_upcasing_unrelated_environment_variable_names ―――――――――――――――――――――――――
self = <test.test_git.TestGit testMethod=test_it_avoids_upcasing_unrelated_environment_variable_names>
@skipUnless(is_win, "The regression only affected Windows, and this test logic is OS-specific.")
def test_it_avoids_upcasing_unrelated_environment_variable_names(self):
old_name = "28f425ca_d5d8_4257_b013_8d63166c8158"
if old_name == old_name.upper():
raise RuntimeError("test bug or strange locale: old_name invariant under upcasing")
os.putenv(old_name, "1") # It has to be done this lower-level way to set it lower-case.
cmdline = [
sys.executable,
fixture_path("env_case.py"),
self.rorepo.working_dir,
old_name,
]
pair_text = subprocess.check_output(cmdline, shell=False, text=True)
new_name = pair_text.split("=")[0]
> self.assertEqual(new_name, old_name)
E AssertionError: '28F425CA_D5D8_4257_B013_8D63166C8158' != '28f425ca_d5d8_4257_b013_8d63166c8158'
E - 28F425CA_D5D8_4257_B013_8D63166C8158
E ? ^ ^^ ^ ^ ^ ^ ^
E + 28f425ca_d5d8_4257_b013_8d63166c8158
E ? ^ ^^ ^ ^ ^ ^ ^
test\test_git.py:123: AssertionError
test/test_git.py ⨯✓ 100% ██████████
=============================================== short test summary info ===============================================
FAILED test/test_git.py::TestGit::test_it_avoids_upcasing_unrelated_environment_variable_names - AssertionError: '28F425CA_D5D8_4257_B013_8D63166C8158' != '28f425ca_d5d8_4257_b013_8d63166c8158'
Results (1.22s):
1 passed
1 failed
- test/test_git.py:108 TestGit.test_it_avoids_upcasing_unrelated_environment_variable_names
501 deselected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment