Mercurial > public > mercurial-scm > hg-stable
view mercurial/testing/ps_util.py @ 52436:cf5b47b885b1
testing: stop skipping all Python tests of Rust revlog
This base class was not adapted for the introduction of `InnerRevlog`,
which also stopped exposing an `Index` class from `rustext`. As a
consequence, `test-rust-ancestor.py` was always skipped (and would
have been slightly broken).
We remove the skipping conditions from `rustancestorstest`, as they
now contradict or repeat those of the base class.
Also, `LazyAncestors` objects apparently hold only one reference to
the inner revlog (they had previously two references on the Rust index).
What matters most of course is the return to `start_count` in these
tests, i.e., that there is no memory leak nor double frees.
In the Python test, we conflate the presence of the `pyo3_rustext` package
with that of `rustext`, as we do not plan to support building one and not
the other (we hope to convert fully to PyO3 soon).
The skipping is actually done by the base test class.
author | Georges Racinet <georges.racinet@cloudcrane.io> |
---|---|
date | Sat, 30 Nov 2024 19:12:02 +0100 |
parents | d4e30c15626d |
children |
line wrap: on
line source
# This python code can be imported into tests in order to terminate a process # with signal.SIGKILL on posix, or a roughly equivalent procedure on Windows. from __future__ import annotations import os import signal import subprocess import sys import tempfile from .. import ( encoding, pycompat, ) from ..utils import procutil def kill_nt(pid: int, exit_code: int): fd, pidfile = tempfile.mkstemp( prefix=b"sigkill-", dir=encoding.environ[b"HGTMP"], text=False ) try: os.write(fd, b'%d\n' % pid) finally: os.close(fd) env = dict(encoding.environ) env[b"DAEMON_EXITCODE"] = b"%d" % exit_code # Simulate the message written to stderr for this process on non-Windows # platforms, for test consistency. print("Killed!", file=sys.stderr) subprocess.run( [ encoding.environ[b"PYTHON"], b"%s/killdaemons.py" % encoding.environ[b'RUNTESTDIR_FORWARD_SLASH'], pidfile, ], env=procutil.tonativeenv(env), ) def kill(pid: int): """Kill the process with the given PID with SIGKILL or equivalent.""" if pycompat.iswindows: exit_code = 128 + 9 kill_nt(pid, exit_code) else: os.kill(pid, signal.SIGKILL)