diff --git a/test/test_sandag_abm3.py b/test/test_sandag_abm3.py index 7603dcc..0ea4e9f 100644 --- a/test/test_sandag_abm3.py +++ b/test/test_sandag_abm3.py @@ -38,119 +38,6 @@ def regress(out_dir: Path, regress_dir: Path = None): pdt.assert_frame_equal(final_trips_df, regress_trips_df) -def run_test_sandag_abm3(multiprocess=False, chunkless=False, sharrow=False): - file_path = os.path.join(os.path.dirname(__file__), "..", "simulation.py") - - run_args = [] - - if multiprocess: - run_args.extend( - [ - "-c", - _test_path("configs_mp"), - "-c", - _example_path("configs_mp"), - ] - ) - elif chunkless: - run_args.extend( - [ - "-c", - _test_path("configs_chunkless"), - ] - ) - elif sharrow: - run_args.extend( - [ - "-c", - _test_path("configs_sharrow"), - ] - ) - if os.environ.get("GITHUB_ACTIONS") != "true": - run_args.append("--persist-sharrow-cache") - else: - run_args.extend( - [ - "-c", - _example_path(r"configs/resident"), - ] - ) - - out_dir = _test_path( - f"output-{'mp' if multiprocess else 'single'}" - f"-{'chunkless' if chunkless else 'chunked'}" - f"-{'sharrow' if sharrow else 'no_sharrow'}" - ) - - # create output directory if it doesn't exist and add .gitignore - Path(out_dir).mkdir(exist_ok=True) - Path(out_dir).joinpath(".gitignore").write_text("**\n") - - run_args.extend( - [ - "-c", - _example_path("configs"), - "-d", - _example_path("data"), - "-o", - out_dir, - ] - ) - - if os.environ.get("GITHUB_ACTIONS") == "true": - subprocess.run(["coverage", "run", "-a", file_path] + run_args, check=True) - else: - subprocess.run([sys.executable, file_path] + run_args, check=True) - - regress(out_dir, _test_path("regress/hh500")) - - -def test_sandag_abm3_cli(): - run_test_sandag_abm3(multiprocess=False) - - -def test_sandag_abm3(): - from activitysim import abm # noqa: F401 - - # make a temp directory for output that will persist for review - tmp_path = Path(__file__).parent.joinpath("output-test_sandag_abm3") - tmp_path.mkdir(exist_ok=True) - - state = workflow.State.make_default( - configs_dir=( - _example_path(r"configs/common"), - _example_path(r"configs/resident"), - ), - data_dir=_example_path("data"), - output_dir=tmp_path, - settings=dict( - cleanup_pipeline_after_run=False, - # recode_pipeline_columns=True, - treat_warnings_as_errors=True, - households_sample_size=100, - # households_sample_size=500, == 12min 43 sec - chunk_size=0, - use_shadow_pricing=True, - ), - ) - state.import_extensions("../extensions") - state.filesystem.persist_sharrow_cache() - state.run.all(resume_after=None) - regress(tmp_path, _test_path("regress/hh500")) - - -def test_sandag_abm3_chunkless(): - run_test_sandag_abm3(multiprocess=False, chunkless=True) - - -def test_sandag_abm3_mp(): - run_test_sandag_abm3(multiprocess=True) - - -def test_sandag_abm3_sharrow(): - run_test_sandag_abm3(sharrow=True) - - EXPECTED_MODELS = [ "initialize_proto_population", "compute_disaggregate_accessibility",