Show More
@@ -2900,7 +2900,7 class TextTestRunner(unittest.TextTestRu | |||
|
2900 | 2900 | with open(jsonpath, 'w') as fp: |
|
2901 | 2901 | self._writejson(self._result, fp) |
|
2902 | 2902 | |
|
2903 |
self._runner._checkhg |
|
|
2903 | self._runner._check_hg('Tested') | |
|
2904 | 2904 | |
|
2905 | 2905 | savetimes(self._runner._outputdir, self._result) |
|
2906 | 2906 | |
@@ -3708,7 +3708,7 class TestRunner: | |||
|
3708 | 3708 | self._usecorrectpython() |
|
3709 | 3709 | if self._installdir: |
|
3710 | 3710 | self._installhg() |
|
3711 |
self._checkhg |
|
|
3711 | self._check_hg("Testing") | |
|
3712 | 3712 | if self.options.chg: |
|
3713 | 3713 | assert self._installdir |
|
3714 | 3714 | self._installchg() |
@@ -3915,15 +3915,6 class TestRunner: | |||
|
3915 | 3915 | wheel_path = self.options.wheel |
|
3916 | 3916 | assert wheel_path |
|
3917 | 3917 | |
|
3918 | # TODO: actually use these flag later, to double check the wheel we | |
|
3919 | # installed match our intend (in `_checkhglib`) | |
|
3920 | if self.options.pure: | |
|
3921 | assert False, b"--pure" | |
|
3922 | elif self.options.rust: | |
|
3923 | assert False, b"--rust" | |
|
3924 | elif self.options.no_rust: | |
|
3925 | assert False, b"--no-rust" | |
|
3926 | ||
|
3927 | 3918 | script = _sys2bytes(os.path.realpath(sys.argv[0])) |
|
3928 | 3919 | exe = _sys2bytes(sysexecutable) |
|
3929 | 3920 | hgroot = os.path.dirname(os.path.dirname(script)) |
@@ -4085,7 +4076,7 class TestRunner: | |||
|
4085 | 4076 | |
|
4086 | 4077 | osenvironb[b'COVERAGE_DIR'] = covdir |
|
4087 | 4078 | |
|
4088 |
def _checkhg |
|
|
4079 | def _check_hg(self, verb): | |
|
4089 | 4080 | """Ensure that the 'mercurial' package imported by python is |
|
4090 | 4081 | the one we expect it to be. If not, print a warning to stderr.""" |
|
4091 | 4082 | if self._pythondir_inferred: |
@@ -4099,6 +4090,42 class TestRunner: | |||
|
4099 | 4090 | 'warning: %s with unexpected mercurial lib: %s\n' |
|
4100 | 4091 | ' (expected %s)\n' % (verb, actualhg, expecthg) |
|
4101 | 4092 | ) |
|
4093 | policy = self._get_hg_module_policy() | |
|
4094 | msg = b"fatal: mercurial binary has unexpected flavor for %s: %s\n" | |
|
4095 | err = None | |
|
4096 | if self.options.pure and policy != b"py": | |
|
4097 | err = msg % (b"--pure", policy) | |
|
4098 | elif self.options.rust and b"rust" not in policy: | |
|
4099 | err = msg % (b"--rust", policy) | |
|
4100 | elif self.options.no_rust and b"rust" in policy: | |
|
4101 | err = msg % (b"--no-rust", policy) | |
|
4102 | if err is not None: | |
|
4103 | err = colorize(err.decode(), "red", self.options.color) | |
|
4104 | sys.stderr.write(err) | |
|
4105 | sys.exit(3) | |
|
4106 | ||
|
4107 | def _get_hg_module_policy(self): | |
|
4108 | """return the module policy as seen by the "hg" binary""" | |
|
4109 | cmd = [ | |
|
4110 | self._real_hg, | |
|
4111 | "debuginstall", | |
|
4112 | "--template", | |
|
4113 | "{hgmodulepolicy}", | |
|
4114 | ] | |
|
4115 | p = subprocess.Popen( | |
|
4116 | cmd, | |
|
4117 | stdout=subprocess.PIPE, | |
|
4118 | stderr=subprocess.PIPE, | |
|
4119 | ) | |
|
4120 | out, err = p.communicate() | |
|
4121 | if p.returncode != 0: | |
|
4122 | msg = "fatal: fetching module policy from `hg` failed:\n" | |
|
4123 | msg = colorize(msg, "red", self.options.color) | |
|
4124 | sys.stderr.write(msg) | |
|
4125 | cmd_err = colorize(err.decode(), "yellow", self.options.color) | |
|
4126 | sys.stderr.write(cmd_err) | |
|
4127 | sys.exit(4) | |
|
4128 | return out | |
|
4102 | 4129 | |
|
4103 | 4130 | def _gethgpath(self): |
|
4104 | 4131 | """Return the path to the mercurial package that is actually found by |
General Comments 0
You need to be logged in to leave comments.
Login now