Skip to content

Commit

Permalink
remove extra tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jpn-- committed Apr 24, 2024
1 parent ad384fa commit b9e9853
Showing 1 changed file with 0 additions and 113 deletions.
113 changes: 0 additions & 113 deletions test/test_sandag_abm3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b9e9853

Please sign in to comment.