tests: remove test environment when running system hg

Summary:
dynamicconfig has logic to avoid loading remote configs during tests,
by checking the TESTTMP variable. Unfortunately, the tests currently run system
hg with that environment set, which causes it to generate incorrect
configuration for the real repository (i.e. fbsource).

Let's get rid of all test specific environment variables when running the system
hg. There's a comment in the code saying this breaks some tests (from 2017
03a31be593db), but as far as I can see they still work.

Reviewed By: quark-zju

Differential Revision: D26758364

fbshipit-source-id: 945cbd36f7eccc98149772a42421cbc51b157c5b
This commit is contained in:
Durham Goode 2021-03-02 12:52:02 -08:00 committed by Facebook GitHub Bot
parent 6451219968
commit 752c5ccff5
2 changed files with 2 additions and 2 deletions

View File

@ -1467,7 +1467,7 @@ class Test(unittest.TestCase):
name_regex = re.compile("^[a-zA-Z][a-zA-Z0-9_]*$")
# Do not restore these variables; otherwise tests would fail.
reqnames = {"PYTHON", "TESTDIR", "TESTTMP"}
reqnames = {}
with open(scriptpath, "w") as envf:
for name, value in origenviron.items():

View File

@ -6,6 +6,6 @@
$ cd "$TESTDIR"/..
$ testrepohg files . > $TESTTMP/filelist
$ testrepohgenv; PYTHONPATH= ./contrib/fix-code.py --dry-run `cat $TESTTMP/filelist`
$ PYTHONPATH= ./contrib/fix-code.py --dry-run `cat $TESTTMP/filelist`
# In case the above list is not empty, run 'contrib/fix-code.py FILE...' to
# fix them.