Show More
@@ -140,9 +140,22 b' def matchoutput(cmd, regexp, ignorestatu' | |||||
140 | """Return the match object if cmd executes successfully and its output |
|
140 | """Return the match object if cmd executes successfully and its output | |
141 | is matched by the supplied regular expression. |
|
141 | is matched by the supplied regular expression. | |
142 | """ |
|
142 | """ | |
|
143 | ||||
|
144 | # Tests on Windows have to fake USERPROFILE to point to the test area so | |||
|
145 | # that `~` is properly expanded on py3.8+. However, some tools like black | |||
|
146 | # make calls that need the real USERPROFILE in order to run `foo --version`. | |||
|
147 | env = os.environ | |||
|
148 | if os.name == 'nt': | |||
|
149 | env = os.environ.copy() | |||
|
150 | env['USERPROFILE'] = env['REALUSERPROFILE'] | |||
|
151 | ||||
143 | r = re.compile(regexp) |
|
152 | r = re.compile(regexp) | |
144 | p = subprocess.Popen( |
|
153 | p = subprocess.Popen( | |
145 | cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT |
|
154 | cmd, | |
|
155 | shell=True, | |||
|
156 | stdout=subprocess.PIPE, | |||
|
157 | stderr=subprocess.STDOUT, | |||
|
158 | env=env, | |||
146 | ) |
|
159 | ) | |
147 | s = p.communicate()[0] |
|
160 | s = p.communicate()[0] | |
148 | ret = p.returncode |
|
161 | ret = p.returncode |
@@ -1371,6 +1371,7 b' class Test(unittest.TestCase):' | |||||
1371 | env['TESTNAME'] = self.name |
|
1371 | env['TESTNAME'] = self.name | |
1372 | env['HOME'] = _bytes2sys(self._testtmp) |
|
1372 | env['HOME'] = _bytes2sys(self._testtmp) | |
1373 | if os.name == 'nt': |
|
1373 | if os.name == 'nt': | |
|
1374 | env['REALUSERPROFILE'] = env['USERPROFILE'] | |||
1374 | # py3.8+ ignores HOME: https://bugs.python.org/issue36264 |
|
1375 | # py3.8+ ignores HOME: https://bugs.python.org/issue36264 | |
1375 | env['USERPROFILE'] = env['HOME'] |
|
1376 | env['USERPROFILE'] = env['HOME'] | |
1376 | formated_timeout = _bytes2sys(b"%d" % default_defaults['timeout'][1]) |
|
1377 | formated_timeout = _bytes2sys(b"%d" % default_defaults['timeout'][1]) |
@@ -1,5 +1,11 b'' | |||||
1 | #require black test-repo |
|
1 | #require black test-repo | |
2 |
|
2 | |||
|
3 | Black needs the real USERPROFILE in order to run on Windows | |||
|
4 | #if msys | |||
|
5 | $ USERPROFILE="$REALUSERPROFILE" | |||
|
6 | $ export USERPROFILE | |||
|
7 | #endif | |||
|
8 | ||||
3 | $ cd $RUNTESTDIR/.. |
|
9 | $ cd $RUNTESTDIR/.. | |
4 | $ black --check --diff `hg files 'set:(**.py + grep("^#!.*python")) - mercurial/thirdparty/**'` |
|
10 | $ black --check --diff `hg files 'set:(**.py + grep("^#!.*python")) - mercurial/thirdparty/**'` | |
5 |
|
11 |
General Comments 0
You need to be logged in to leave comments.
Login now