Better document env_case test/fixture and cwd by EliahKagan · Pull Request #1657 · gitpython-developers/GitPython
# 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)