Skip to content

Commit

Permalink
only define outermost dir in conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
hussain-jafari committed Jan 23, 2025
1 parent a810c84 commit 817099d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 5 additions & 4 deletions tests/integration/release/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def pytest_addoption(parser: pytest.Parser) -> None:
# Fixtures #
############
@pytest.fixture(scope="session")
def release_log_dir() -> Path:
def release_dir() -> Path:
output_dir_name = (
"/mnt/team/simulation_science/priv/engineering/pseudopeople_release_testing/error_logs"
"/mnt/team/simulation_science/priv/engineering/pseudopeople_release_testing"
)
output_dir = Path(output_dir_name) / f"{time.strftime('%Y%m%d_%H%M%S')}"
output_dir.mkdir(parents=True, exist_ok=False)
Expand Down Expand Up @@ -132,7 +132,7 @@ def dataset_params(
@pytest.fixture(scope="session")
def noised_data(
dataset_params: tuple[str | int | Callable[..., pd.DataFrame] | None, ...],
release_output_dir: Path,
release_dir: Path,
request: pytest.FixtureRequest,
config: dict[str, Any],
) -> pd.DataFrame:
Expand All @@ -150,7 +150,8 @@ def noised_data(
}
if dataset_func != generate_social_security:
kwargs["state"] = state
noised_data = profile_data_generation(release_output_dir)(dataset_func)(**kwargs)
profiling_dir = release_dir / "profiling"
noised_data = profile_data_generation(profiling_dir)(dataset_func)(**kwargs)
if engine == "dask":
# mypy expects noised_data to be a series rather than dask object
noised_data = noised_data.compute() # type: ignore [operator]
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/release/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@
],
ids=['1','2','3','4']
)
def test_release_tests(pytest_args: list[str], release_logging_dir: Path, request) -> None:
def test_release_tests(pytest_args: list[str], release_dir: Path, request) -> None:
os.chdir(Path(__file__).parent) # need this to access cli options from conftest.py
base_cmd = ["pytest", "--release", "test_release.py"]
cmd = base_cmd + pytest_args
job_id = request.node.callspec.id
log_file = f"{release_logging_dir}/pytest_{job_id}.o"
# Open a file in write mode
log_file = release_dir / "logs" / f"pytest_{job_id}.o"
with open(log_file, 'w') as file:
# Run pytest and direct stdout to the log file
subprocess.run(cmd, stdout=file)


Expand Down

0 comments on commit 817099d

Please sign in to comment.