@@ -43,10 +43,11 @@ def test_set_env():
4343 assert environ .get (key ) is None
4444
4545
46- _repos_path = environ .get ("REPOS_PATH" )
47- if _repos_path is None :
48- _repos_path = Path (__file__ ).parent .parent .parent .parent
49- _repos_path = Path (_repos_path ).expanduser ().absolute ()
46+ _repos_path_str = environ .get ("REPOS_PATH" )
47+ if _repos_path_str is None :
48+ _repos_path : Path = Path (__file__ ).parent .parent .parent .parent
49+ else :
50+ _repos_path = Path (_repos_path_str ).expanduser ().absolute ()
5051_testmodels_repo_path = _repos_path / "modflow6-testmodels"
5152_testmodels_repo_paths_mf6 = sorted ((_testmodels_repo_path / "mf6" ).glob ("test*" ))
5253_testmodels_repo_paths_mf5to6 = sorted ((_testmodels_repo_path / "mf5to6" ).glob ("test*" ))
@@ -57,9 +58,7 @@ def test_set_env():
5758_example_paths = sorted (_examples_path .glob ("ex-*" )) if _examples_path .is_dir () else []
5859
5960
60- @pytest .mark .skipif (
61- not any (_testmodels_repo_paths_mf6 ), reason = "mf6 test models not found"
62- )
61+ @pytest .mark .skipif (not any (_testmodels_repo_paths_mf6 ), reason = "mf6 test models not found" )
6362def test_get_packages ():
6463 model_path = _testmodels_repo_paths_mf6 [0 ]
6564
@@ -79,9 +78,7 @@ def test_get_packages():
7978 assert "ims" not in packages
8079
8180
82- @pytest .mark .skipif (
83- not any (_testmodels_repo_paths_mf6 ), reason = "mf6 test models not found"
84- )
81+ @pytest .mark .skipif (not any (_testmodels_repo_paths_mf6 ), reason = "mf6 test models not found" )
8582def test_get_packages_fails_on_invalid_namefile (module_tmpdir ):
8683 model_path = _testmodels_repo_paths_mf6 [0 ]
8784 new_model_path = module_tmpdir / model_path .name
@@ -132,7 +129,7 @@ def get_expected_model_dirs(path, pattern="mfsim.nam") -> list[Path]:
132129
133130
134131def get_expected_namefiles (path , pattern = "mfsim.nam" ) -> list [Path ]:
135- folders = []
132+ folders : list [ Path ] = []
136133 for root , dirs , _ in os .walk (path ):
137134 for d in dirs :
138135 p = Path (root ) / d
@@ -154,9 +151,7 @@ def test_get_model_paths_examples():
154151 assert set (expected_paths ) == set (paths )
155152
156153
157- @pytest .mark .skipif (
158- not any (_largetestmodel_paths ), reason = "modflow6-largetestmodels not found"
159- )
154+ @pytest .mark .skipif (not any (_largetestmodel_paths ), reason = "modflow6-largetestmodels not found" )
160155def test_get_model_paths_largetestmodels ():
161156 expected_paths = get_expected_model_dirs (_examples_path )
162157 paths = get_model_paths (_examples_path )
@@ -173,9 +168,7 @@ def test_get_model_paths_largetestmodels():
173168 not any (_largetestmodel_paths ) or not any (_example_paths ),
174169 reason = "repos not found" ,
175170)
176- @pytest .mark .parametrize (
177- "models" , [(_examples_path , 63 ), (_largetestmodels_repo_path , 16 )]
178- )
171+ @pytest .mark .parametrize ("models" , [(_examples_path , 63 ), (_largetestmodels_repo_path , 16 )])
179172def test_get_model_paths_exclude_patterns (models ):
180173 path , expected_count = models
181174 paths = get_model_paths (path , excluded = ["gwt" ])
@@ -195,9 +188,7 @@ def test_get_namefile_paths_examples():
195188 assert set (expected_paths ) == set (paths )
196189
197190
198- @pytest .mark .skipif (
199- not any (_largetestmodel_paths ), reason = "modflow6-largetestmodels not found"
200- )
191+ @pytest .mark .skipif (not any (_largetestmodel_paths ), reason = "modflow6-largetestmodels not found" )
201192def test_get_namefile_paths_largetestmodels ():
202193 expected_paths = get_expected_namefiles (_largetestmodels_repo_path )
203194 paths = get_namefile_paths (_largetestmodels_repo_path )
@@ -214,9 +205,7 @@ def test_get_namefile_paths_largetestmodels():
214205 not any (_largetestmodel_paths ) or not any (_example_paths ),
215206 reason = "repos not found" ,
216207)
217- @pytest .mark .parametrize (
218- "models" , [(_examples_path , 43 ), (_largetestmodels_repo_path , 19 )]
219- )
208+ @pytest .mark .parametrize ("models" , [(_examples_path , 43 ), (_largetestmodels_repo_path , 19 )])
220209def test_get_namefile_paths_exclude_patterns (models ):
221210 path , expected_count = models
222211 paths = get_namefile_paths (path , excluded = ["gwf" ])
0 commit comments