Skip to content

Commit 947f37a

Browse files
committed
chore(deps): update pytest to 8.*
Signed-off-by: Charles Moore <122481442+moorec-aws@users.noreply.github.com>
1 parent b1f1351 commit 947f37a

File tree

6 files changed

+35
-4
lines changed

6 files changed

+35
-4
lines changed

conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
3+
import os
4+
import sys
5+
from pathlib import Path
6+
7+
8+
# This ensures test modules can be imported in subprocesses
9+
def pytest_configure(config):
10+
test_path = Path(__file__).parent / "test" / "openjd" / "adaptor_runtime" / "integ"
11+
if test_path.exists():
12+
sys.path.append(str(test_path))
13+
os.environ["PYTHONPATH"] = os.pathsep.join(
14+
[os.environ.get("PYTHONPATH", ""), str(test_path)]
15+
).strip(os.pathsep)

requirements-testing.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
coverage[toml] == 7.*
22
coverage-conditional-plugin == 0.9.0
3-
pytest == 7.4.*
3+
pytest == 8.3.*
44
pytest-cov == 6.1.*
55
pytest-timeout == 2.4.*
66
pytest-xdist == 3.6.*

src/openjd/adaptor_runtime/_background/frontend_runner.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,10 @@ def _wait_for_connection_file(
430430
Raises:
431431
TimeoutError: Raised when the file does not exist after timeout_s seconds.
432432
"""
433+
# Increase max_retries for Windows to account for potential filesystem delays
434+
if OSName.is_windows():
435+
max_retries = max(max_retries * 2, 10)
436+
433437
wait_for(
434438
description=f"File '{filepath}' to exist",
435439
predicate=lambda: os.path.exists(filepath),
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22

3-
from .__main__ import main
43
from .adaptor import CommandAdaptorExample
54

6-
__all__ = ["CommandAdaptorExample", "main"]
5+
__all__ = ["CommandAdaptorExample"]

test/openjd/adaptor_runtime/integ/background/test_background_mode.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@
2929

3030
mod_path = (Path(__file__).parent.parent).resolve()
3131
sys.path.append(str(mod_path))
32+
33+
# Fix for pytest 8.3+ on Windows - ensure module path is properly set in environment
3234
if (_pypath := os.environ.get("PYTHONPATH")) is not None:
3335
os.environ["PYTHONPATH"] = os.pathsep.join((_pypath, str(mod_path)))
3436
else:
3537
os.environ["PYTHONPATH"] = str(mod_path)
38+
39+
# Add the module path to PYTHONPATH for subprocesses
40+
os.environ["PYTEST_XDIST_WORKER_PYTHONPATH"] = str(mod_path)
41+
3642
from AdaptorExample import AdaptorExample # noqa: E402
3743

3844

test/openjd/adaptor_runtime/integ/test_integration_entrypoint.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,17 @@
2020

2121
mod_path = Path(__file__).parent.resolve()
2222
sys.path.append(str(mod_path))
23+
24+
# Fix for pytest 8.3+ on Windows - ensure module path is properly set in environment
25+
path_sep = ";" if sys.platform == "win32" else ":"
2326
if (_pypath := os.environ.get("PYTHONPATH")) is not None:
24-
os.environ["PYTHONPATH"] = ":".join((_pypath, str(mod_path)))
27+
os.environ["PYTHONPATH"] = path_sep.join([_pypath, str(mod_path)])
2528
else:
2629
os.environ["PYTHONPATH"] = str(mod_path)
30+
31+
# Add the module path to PYTHONPATH for subprocesses
32+
os.environ["PYTEST_XDIST_WORKER_PYTHONPATH"] = str(mod_path)
33+
2734
from CommandAdaptorExample import CommandAdaptorExample # noqa: E402
2835

2936

0 commit comments

Comments
 (0)