diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -202,6 +202,22 @@ def has_pyoxidizer(): 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 --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -3451,6 +3451,9 @@ class TestRunner: 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 @@ class TestRunner: 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