# HG changeset patch # User Matt Harbison # Date 1670349774 18000 # Node ID a2356e15200a7c222d42d7064d1772d97f8697f5 # Parent 9a4c76cc8fe6dedf5d6b6c41fdf957c83c0df98a hghave: add predicates for embedded and filesystem pyoxidizer resources There are a handful of tests with different output between the two flavors of pyoxidizer builds (like the location of the modules and templates), and a few others that avoid `known-bad-output` cases with the embedded resources that shouldn't cause the tests to fail. diff -r 9a4c76cc8fe6 -r a2356e15200a tests/hghave.py --- a/tests/hghave.py Mon Dec 05 11:49:56 2022 -0500 +++ b/tests/hghave.py Tue Dec 06 13:02:54 2022 -0500 @@ -202,6 +202,22 @@ return 'PYOXIDIZED_INSTALLED_AS_HG' in os.environ +@check( + "pyoxidizer-in-memory", + "running with pyoxidizer build as 'hg' with embedded resources", +) +def has_pyoxidizer(): + return 'PYOXIDIZED_IN_MEMORY_RSRC' in os.environ + + +@check( + "pyoxidizer-in-filesystem", + "running with pyoxidizer build as 'hg' with external resources", +) +def has_pyoxidizer(): + return 'PYOXIDIZED_FILESYSTEM_RSRC' in os.environ + + @check("cvs", "cvs client/server") def has_cvs(): re = br'Concurrent Versions System.*?server' diff -r 9a4c76cc8fe6 -r a2356e15200a tests/run-tests.py --- a/tests/run-tests.py Mon Dec 05 11:49:56 2022 -0500 +++ b/tests/run-tests.py Tue Dec 06 13:02:54 2022 -0500 @@ -3451,6 +3451,9 @@ verbosity = 2 runner = TextTestRunner(self, verbosity=verbosity) + osenvironb.pop(b'PYOXIDIZED_IN_MEMORY_RSRC', None) + osenvironb.pop(b'PYOXIDIZED_FILESYSTEM_RSRC', None) + if self.options.list_tests: result = runner.listtests(suite) else: @@ -3886,6 +3889,20 @@ sys.stdout.buffer.write(out) sys.exit(1) + cmd = _bytes2sys(b"%s debuginstall -Tjson" % self._hgcommand) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) + out, err = p.communicate() + + props = json.loads(out)[0] + + # Affects hghave.py + osenvironb.pop(b'PYOXIDIZED_IN_MEMORY_RSRC', None) + osenvironb.pop(b'PYOXIDIZED_FILESYSTEM_RSRC', None) + if props["hgmodules"] == props["pythonexe"]: + osenvironb[b'PYOXIDIZED_IN_MEMORY_RSRC'] = b'1' + else: + osenvironb[b'PYOXIDIZED_FILESYSTEM_RSRC'] = b'1' + def _outputcoverage(self): """Produce code coverage output.""" import coverage