11
11
from activitysim .core import testing , workflow
12
12
13
13
14
- def example_path (dirname ):
14
+ def _example_path (dirname ):
15
+ """Paths to things in the top-level directory of this repository."""
15
16
return os .path .normpath (os .path .join (os .path .dirname (__file__ ), ".." , dirname ))
16
17
17
18
18
- def test_path (dirname ):
19
+ def _test_path (dirname ):
20
+ """Paths to things in the `test` directory."""
19
21
return os .path .join (os .path .dirname (__file__ ), dirname )
20
22
21
23
@@ -25,10 +27,10 @@ def run_test_mtc(
25
27
26
28
def regress (ext ):
27
29
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" ))
29
31
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" ))
32
34
33
35
# column order may not match, so fix it before checking
34
36
assert sorted (regress_trips_df .columns ) == sorted (final_trips_df .columns )
@@ -48,39 +50,39 @@ def regress(ext):
48
50
run_args .extend (
49
51
[
50
52
"-c" ,
51
- test_path ("ext-configs_mp" ),
53
+ _test_path ("ext-configs_mp" ),
52
54
"-c" ,
53
- example_path ("ext-configs_mp" ),
55
+ _example_path ("ext-configs_mp" ),
54
56
]
55
57
)
56
58
else :
57
59
run_args .extend (
58
60
[
59
61
"-c" ,
60
- test_path ("configs_mp" ),
62
+ _test_path ("configs_mp" ),
61
63
"-c" ,
62
- example_path ("configs_mp" ),
64
+ _example_path ("configs_mp" ),
63
65
]
64
66
)
65
67
elif chunkless :
66
68
run_args .extend (
67
69
[
68
70
"-c" ,
69
- test_path ("configs_chunkless" ),
71
+ _test_path ("configs_chunkless" ),
70
72
]
71
73
)
72
74
elif recode :
73
75
run_args .extend (
74
76
[
75
77
"-c" ,
76
- test_path ("configs_recode" ),
78
+ _test_path ("configs_recode" ),
77
79
]
78
80
)
79
81
elif sharrow :
80
82
run_args .extend (
81
83
[
82
84
"-c" ,
83
- test_path ("configs_sharrow" ),
85
+ _test_path ("configs_sharrow" ),
84
86
]
85
87
)
86
88
if os .environ .get ("GITHUB_ACTIONS" ) != "true" :
@@ -89,7 +91,7 @@ def regress(ext):
89
91
run_args .extend (
90
92
[
91
93
"-c" ,
92
- test_path ("configs" ),
94
+ _test_path ("configs" ),
93
95
]
94
96
)
95
97
@@ -98,15 +100,15 @@ def regress(ext):
98
100
run_args .extend (
99
101
[
100
102
"--data_model" ,
101
- example_path ("data_model" ),
103
+ _example_path ("data_model" ),
102
104
"-c" ,
103
- test_path ("ext-configs" ),
105
+ _test_path ("ext-configs" ),
104
106
"-c" ,
105
- example_path ("ext-configs" ),
107
+ _example_path ("ext-configs" ),
106
108
]
107
109
)
108
110
109
- out_dir = test_path (
111
+ out_dir = _test_path (
110
112
f"output-{ 'mp' if multiprocess else 'single' } "
111
113
f"-{ 'chunkless' if chunkless else 'chunked' } "
112
114
f"-{ 'recode' if recode else 'no_recode' } "
@@ -121,9 +123,9 @@ def regress(ext):
121
123
run_args .extend (
122
124
[
123
125
"-c" ,
124
- example_path ("configs" ),
126
+ _example_path ("configs" ),
125
127
"-d" ,
126
- example_path ("data" ),
128
+ _example_path ("data" ),
127
129
"-o" ,
128
130
out_dir ,
129
131
]
@@ -225,20 +227,20 @@ def test_mtc_extended_progressive():
225
227
226
228
import activitysim .abm # register components # noqa: F401
227
229
228
- out_dir = test_path ("output-progressive" )
230
+ out_dir = _test_path ("output-progressive" )
229
231
Path (out_dir ).mkdir (exist_ok = True )
230
232
Path (out_dir ).joinpath (".gitignore" ).write_text ("**\n " )
231
233
232
234
state = workflow .State .make_default (
233
235
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" ),
239
241
),
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" ),
242
244
output_dir = out_dir ,
243
245
)
244
246
state .filesystem .persist_sharrow_cache ()
0 commit comments