Skip to content

Commit 7a20592

Browse files
committed
Organize tests under line count limit
1 parent 5380e80 commit 7a20592

32 files changed

Lines changed: 3030 additions & 2699 deletions

pkgs/tigrcorn-certification/src/tigrcorn_certification/interop_runner/adapters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from .models import *
55
from .process import *
66
from .helpers import *
7+
from .ports import _wait_for_server_ready
78

89
class BasePeerAdapter:
910
def inspect_version(self, spec: InteropProcessSpec, *, env: Mapping[str, str], cwd: Path | None) -> dict[str, Any]:

pkgs/tigrcorn-certification/src/tigrcorn_certification/interop_runner/environment.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
from .imports import *
44
from .models import *
5+
from .adapters import BasePeerAdapter, _ADAPTERS
56
from .helpers import *
7+
from .helpers import _apply_template, _probe_command, _sha256_bytes, _sha256_path
8+
from tigrcorn_core.version import __version__
69

710
def detect_source_revision(source_root: str | Path) -> str:
811
env_commit = os.environ.get('TIGRCORN_COMMIT_HASH') or os.environ.get('GIT_COMMIT')
@@ -122,6 +125,14 @@ def _instantiate_adapter(name: str) -> BasePeerAdapter:
122125
return _ADAPTERS[name]()
123126
except KeyError as exc:
124127
raise InteropRunnerError(f'unknown interop adapter: {name}') from exc
128+
129+
130+
def _resolve_process_command(command: list[str]) -> list[str]:
131+
if command and command[0] == '/opt/pyvenv/bin/python':
132+
return [os.environ.get('TIGRCORN_INTEROP_PYTHON', os.sys.executable), *command[1:]]
133+
return command
134+
135+
125136
def _materialize_process_spec(spec: InteropProcessSpec, context: Mapping[str, str]) -> InteropProcessSpec:
126137
return InteropProcessSpec(
127138
name=_apply_template(spec.name, context),

pkgs/tigrcorn-certification/src/tigrcorn_certification/interop_runner/process.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ def __init__(self, process: subprocess.Popen[Any], stdout_path: Path, stderr_pat
1010
self.stderr_path = stderr_path
1111

1212
def stop(self, *, timeout: float = 5.0) -> int | None:
13+
if os.name == 'nt' and self.process.poll() is None:
14+
try:
15+
subprocess.run(
16+
['taskkill', '/PID', str(self.process.pid), '/T', '/F'],
17+
capture_output=True,
18+
text=True,
19+
timeout=timeout,
20+
)
21+
except Exception:
22+
pass
23+
try:
24+
self.process.wait(timeout=timeout)
25+
except subprocess.TimeoutExpired:
26+
return None
27+
return self.process.returncode
1328
if self.process.poll() is None:
1429
try:
1530
self.process.terminate()

pkgs/tigrcorn-certification/src/tigrcorn_certification/interop_runner/proxies.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from .imports import *
44
from .helpers import *
5+
from .ports import _normalize_sockaddr
56

67
class _PacketTraceWriter:
78
def __init__(self, path: Path) -> None:

pkgs/tigrcorn-certification/src/tigrcorn_certification/interop_runner/scenario.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from .imports import *
33
from .models import *
44
from .adapters import *
5+
from .assertions import *
56
from .proxies import *
67
from .environment import *
78
from .matrix import *

0 commit comments

Comments
 (0)