Skip to content

Commit bf39b7a

Browse files
committed
test extended
1 parent 51560b3 commit bf39b7a

File tree

1 file changed

+83
-50
lines changed

1 file changed

+83
-50
lines changed

test/test_mtc.py

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

1313

14-
def run_test_mtc(multiprocess=False, chunkless=False, recode=False, sharrow=False):
14+
def run_test_mtc(
15+
multiprocess=False, chunkless=False, recode=False, sharrow=False, extended=False
16+
):
1517
def example_path(dirname):
16-
return os.path.normpath(
17-
os.path.join(os.path.dirname(__file__), "..", dirname)
18-
)
18+
return os.path.normpath(os.path.join(os.path.dirname(__file__), "..", dirname))
1919

2020
def test_path(dirname):
2121
return os.path.join(os.path.dirname(__file__), dirname)
@@ -35,65 +35,78 @@ def regress():
3535

3636
file_path = os.path.join(os.path.dirname(__file__), "simulation.py")
3737

38+
run_args = []
39+
3840
if multiprocess:
39-
run_args = [
40-
"-c",
41-
test_path("configs_mp"),
42-
"-c",
43-
example_path("configs_mp"),
44-
"-c",
45-
example_path("configs"),
46-
"-d",
47-
example_path("data"),
48-
"-o",
49-
test_path("output"),
50-
]
41+
if extended:
42+
run_args.extend(
43+
[
44+
"-c",
45+
test_path("ext-configs_mp"),
46+
"-c",
47+
example_path("ext-configs_mp"),
48+
]
49+
)
50+
else:
51+
run_args.extend(
52+
[
53+
"-c",
54+
test_path("configs_mp"),
55+
"-c",
56+
example_path("configs_mp"),
57+
]
58+
)
5159
elif chunkless:
52-
run_args = [
53-
"-c",
54-
test_path("configs_chunkless"),
55-
"-c",
56-
example_path("configs"),
57-
"-d",
58-
example_path("data"),
59-
"-o",
60-
test_path("output"),
61-
]
60+
run_args.extend(
61+
[
62+
"-c",
63+
test_path("configs_chunkless"),
64+
]
65+
)
6266
elif recode:
63-
run_args = [
64-
"-c",
65-
test_path("configs_recode"),
66-
"-c",
67-
example_path("configs"),
68-
"-d",
69-
example_path("data"),
70-
"-o",
71-
test_path("output"),
72-
]
67+
run_args.extend(
68+
[
69+
"-c",
70+
test_path("configs_recode"),
71+
]
72+
)
7373
elif sharrow:
74-
run_args = [
75-
"-c",
76-
test_path("configs_sharrow"),
77-
"-c",
78-
example_path("configs"),
79-
"-d",
80-
example_path("data"),
81-
"-o",
82-
test_path("output"),
83-
]
74+
run_args.extend(
75+
[
76+
"-c",
77+
test_path("configs_sharrow"),
78+
]
79+
)
8480
if os.environ.get("GITHUB_ACTIONS") != "true":
8581
run_args.append("--persist-sharrow-cache")
8682
else:
87-
run_args = [
88-
"-c",
89-
test_path("configs"),
83+
run_args.extend(
84+
[
85+
"-c",
86+
test_path("configs"),
87+
]
88+
)
89+
90+
# general run args
91+
if extended:
92+
run_args.extend(
93+
[
94+
"-c",
95+
test_path("ext-configs"),
96+
"-c",
97+
example_path("ext-configs"),
98+
]
99+
)
100+
run_args.extend(
101+
[
90102
"-c",
91103
example_path("configs"),
92104
"-d",
93105
example_path("data"),
94106
"-o",
95107
test_path("output"),
96108
]
109+
)
97110

98111
if os.environ.get("GITHUB_ACTIONS") == "true":
99112
subprocess.run(["coverage", "run", "-a", file_path] + run_args, check=True)
@@ -123,6 +136,26 @@ def test_mtc_sharrow():
123136
run_test_mtc(sharrow=True)
124137

125138

139+
def test_mtc_ext():
140+
run_test_mtc(multiprocess=False, extended=True)
141+
142+
143+
def test_mtc_chunkless_ext():
144+
run_test_mtc(multiprocess=False, chunkless=True, extended=True)
145+
146+
147+
def test_mtc_mp_ext():
148+
run_test_mtc(multiprocess=True, extended=True)
149+
150+
151+
def test_mtc_recode_ext():
152+
run_test_mtc(recode=True, extended=True)
153+
154+
155+
def test_mtc_sharrow_ext():
156+
run_test_mtc(sharrow=True, extended=True)
157+
158+
126159
EXPECTED_MODELS = [
127160
"initialize_landuse",
128161
"initialize_households",
@@ -171,7 +204,7 @@ def test_mtc_progressive():
171204

172205
assert whale.settings.models == EXPECTED_MODELS
173206
assert whale.settings.chunk_size == 0
174-
assert whale.settings.sharrow == False
207+
assert not whale.settings.sharrow
175208

176209
for step_name in EXPECTED_MODELS:
177210
whale.run.by_name(step_name)

0 commit comments

Comments
 (0)