Skip to content

Commit d4ab847

Browse files
committed
fix
1 parent 7b7ab6e commit d4ab847

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
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+
# This ensures test modules can be imported in subprocesses
8+
def pytest_configure(config):
9+
test_path = Path(__file__).parent / "test" / "openjd" / "adaptor_runtime" / "integ"
10+
if test_path.exists():
11+
sys.path.append(str(test_path))
12+
os.environ["PYTHONPATH"] = os.pathsep.join([
13+
os.environ.get("PYTHONPATH", ""),
14+
str(test_path)
15+
]).strip(os.pathsep)
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)