Skip to content

Commit e72dbc5

Browse files
authored
Merge pull request #7 from camsys/extended-testing
fix test_path function
2 parents 279d3d9 + 08b864a commit e72dbc5

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

test/test_mtc.py

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
from activitysim.core import testing, workflow
1212

1313

14-
def example_path(dirname):
14+
def _example_path(dirname):
15+
"""Paths to things in the top-level directory of this repository."""
1516
return os.path.normpath(os.path.join(os.path.dirname(__file__), "..", dirname))
1617

1718

18-
def test_path(dirname):
19+
def _test_path(dirname):
20+
"""Paths to things in the `test` directory."""
1921
return os.path.join(os.path.dirname(__file__), dirname)
2022

2123

@@ -25,10 +27,10 @@ def run_test_mtc(
2527

2628
def regress(ext):
2729
if ext:
28-
regress_trips_df = pd.read_csv(test_path("regress/final_trips-ext.csv"))
30+
regress_trips_df = pd.read_csv(_test_path("regress/final_trips-ext.csv"))
2931
else:
30-
regress_trips_df = pd.read_csv(test_path("regress/final_trips.csv"))
31-
final_trips_df = pd.read_csv(test_path("output/final_trips.csv"))
32+
regress_trips_df = pd.read_csv(_test_path("regress/final_trips.csv"))
33+
final_trips_df = pd.read_csv(_test_path("output/final_trips.csv"))
3234

3335
# column order may not match, so fix it before checking
3436
assert sorted(regress_trips_df.columns) == sorted(final_trips_df.columns)
@@ -48,39 +50,39 @@ def regress(ext):
4850
run_args.extend(
4951
[
5052
"-c",
51-
test_path("ext-configs_mp"),
53+
_test_path("ext-configs_mp"),
5254
"-c",
53-
example_path("ext-configs_mp"),
55+
_example_path("ext-configs_mp"),
5456
]
5557
)
5658
else:
5759
run_args.extend(
5860
[
5961
"-c",
60-
test_path("configs_mp"),
62+
_test_path("configs_mp"),
6163
"-c",
62-
example_path("configs_mp"),
64+
_example_path("configs_mp"),
6365
]
6466
)
6567
elif chunkless:
6668
run_args.extend(
6769
[
6870
"-c",
69-
test_path("configs_chunkless"),
71+
_test_path("configs_chunkless"),
7072
]
7173
)
7274
elif recode:
7375
run_args.extend(
7476
[
7577
"-c",
76-
test_path("configs_recode"),
78+
_test_path("configs_recode"),
7779
]
7880
)
7981
elif sharrow:
8082
run_args.extend(
8183
[
8284
"-c",
83-
test_path("configs_sharrow"),
85+
_test_path("configs_sharrow"),
8486
]
8587
)
8688
if os.environ.get("GITHUB_ACTIONS") != "true":
@@ -89,7 +91,7 @@ def regress(ext):
8991
run_args.extend(
9092
[
9193
"-c",
92-
test_path("configs"),
94+
_test_path("configs"),
9395
]
9496
)
9597

@@ -98,15 +100,15 @@ def regress(ext):
98100
run_args.extend(
99101
[
100102
"--data_model",
101-
example_path("data_model"),
103+
_example_path("data_model"),
102104
"-c",
103-
test_path("ext-configs"),
105+
_test_path("ext-configs"),
104106
"-c",
105-
example_path("ext-configs"),
107+
_example_path("ext-configs"),
106108
]
107109
)
108110

109-
out_dir = test_path(
111+
out_dir = _test_path(
110112
f"output-{'mp' if multiprocess else 'single'}"
111113
f"-{'chunkless' if chunkless else 'chunked'}"
112114
f"-{'recode' if recode else 'no_recode'}"
@@ -121,9 +123,9 @@ def regress(ext):
121123
run_args.extend(
122124
[
123125
"-c",
124-
example_path("configs"),
126+
_example_path("configs"),
125127
"-d",
126-
example_path("data"),
128+
_example_path("data"),
127129
"-o",
128130
out_dir,
129131
]
@@ -225,20 +227,20 @@ def test_mtc_extended_progressive():
225227

226228
import activitysim.abm # register components # noqa: F401
227229

228-
out_dir = test_path("output-progressive")
230+
out_dir = _test_path("output-progressive")
229231
Path(out_dir).mkdir(exist_ok=True)
230232
Path(out_dir).joinpath(".gitignore").write_text("**\n")
231233

232234
state = workflow.State.make_default(
233235
configs_dir=(
234-
test_path("configs_recode"),
235-
test_path("ext-configs"),
236-
example_path("ext-configs"),
237-
test_path("configs"),
238-
example_path("configs"),
236+
_test_path("configs_recode"),
237+
_test_path("ext-configs"),
238+
_example_path("ext-configs"),
239+
_test_path("configs"),
240+
_example_path("configs"),
239241
),
240-
data_dir=example_path("data"),
241-
data_model_dir=example_path("data_model"),
242+
data_dir=_example_path("data"),
243+
data_model_dir=_example_path("data_model"),
242244
output_dir=out_dir,
243245
)
244246
state.filesystem.persist_sharrow_cache()

0 commit comments

Comments
 (0)