-
-
Notifications
You must be signed in to change notification settings - Fork 906
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1657 from EliahKagan/envcase-doc
Better document env_case test/fixture and cwd
- Loading branch information
Showing
3 changed files
with
21 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
# Steps 3 and 4 for test_it_avoids_upcasing_unrelated_environment_variable_names. | ||
|
||
import subprocess | ||
import sys | ||
|
||
# Step 3a: Import the module, in case that upcases the environment variable name. | ||
import git | ||
|
||
|
||
_, working_dir, env_var_name = sys.argv | ||
|
||
# Importing git should be enough, but this really makes sure Git.execute is called. | ||
# Step 3b: Use Git.execute explicitly, in case that upcases the environment variable. | ||
# (Importing git should be enough, but this ensures Git.execute is called.) | ||
repo = git.Repo(working_dir) # Hold the reference. | ||
git.Git(repo.working_dir).execute(["git", "version"]) | ||
|
||
# Step 4: Create the non-Python grandchild that accesses the variable case-sensitively. | ||
print(subprocess.check_output(["set", env_var_name], shell=True, text=True)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters