◐ Shell
clean mode source ↗

Better document env_case test/fixture and cwd by EliahKagan · Pull Request #1657 · gitpython-developers/GitPython

Expand Up @@ -98,15 +98,23 @@ 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.
# Step 1: Set the environment variable in this parent process. Because os.putenv is a thin # wrapper around a system API, os.environ never sees the variable in this parent # process, so the name is not upcased even on Windows. os.putenv(old_name, "1")
# Step 2: Create the child process that inherits the environment variable. The child uses # GitPython, and we are testing that it passes the variable with the exact original # name to its own child process (the grandchild). cmdline = [ sys.executable, fixture_path("env_case.py"), fixture_path("env_case.py"), # Contains steps 3 and 4. self.rorepo.working_dir, old_name, ] pair_text = subprocess.check_output(cmdline, shell=False, text=True) pair_text = subprocess.check_output(cmdline, shell=False, text=True) # Run steps 3 and 4.
new_name = pair_text.split("=")[0] self.assertEqual(new_name, old_name)
Expand Down