Skip to content
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions tests/integration/release/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,11 @@ def pytest_addoption(parser: pytest.Parser) -> None:
############
# Fixtures #
############
@pytest.fixture(scope="session")
@pytest.fixture(scope="module")
def release_output_dir() -> Path:
# TODO: [MIC-5522] define correct output dir
# output_dir = os.environ.get("PSP_TEST_OUTPUT_DIR")
output_dir_name = (
"/mnt/team/simulation_science/priv/engineering/pseudopeople_release_testing"
"/mnt/team/simulation_science/priv/engineering/pseudopeople_release_testing/"
)
# if not output_dir_name:
# raise ValueError("PSP_TEST_OUTPUT_DIR environment variable not set")
output_dir = Path(output_dir_name) / f"{time.strftime('%Y%m%d_%H%M%S')}"
output_dir.mkdir(parents=True, exist_ok=False)
return output_dir.resolve()
Expand Down Expand Up @@ -154,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_output_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
15 changes: 12 additions & 3 deletions tests/integration/release/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,22 @@
(["--dataset", "wic", "--year", "2015"]),
# (["--dataset", "wic", "--population", "USA", "--state", "RI", "--year", "2015"]),
],
ids=["1", "2", "3", "4"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the changes in this life will eventually be the responsibility of jobmon, so these are just here as a placeholder for testing.

)
def test_release_tests(pytest_args: list[str]) -> None:
def test_release_tests(
pytest_args: list[str], release_output_dir: Path, request: pytest.FixtureRequest
) -> 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
result = subprocess.run(cmd, capture_output=True, text=True)
assert result.returncode == 0

# log using job id
job_id = request.node.callspec.id
log_dir = release_output_dir / "logs"
log_dir.mkdir(parents=True, exist_ok=True)
log_file = log_dir / f"pytest_{job_id}.o"
with open(log_file, "w") as file:
subprocess.run(cmd, stdout=file)


@pytest.mark.parametrize("dataset", ["acs", "cps"])
Expand Down
Loading