diff --git a/src/uwtools/tests/drivers/test_chgres_cube.py b/src/uwtools/tests/drivers/test_chgres_cube.py index 052d9b2b2..ac4f50463 100644 --- a/src/uwtools/tests/drivers/test_chgres_cube.py +++ b/src/uwtools/tests/drivers/test_chgres_cube.py @@ -10,7 +10,7 @@ import f90nml # type: ignore from iotaa import refs -from pytest import fixture +from pytest import fixture, mark from uwtools.drivers.chgres_cube import ChgresCube from uwtools.drivers.driver import Driver @@ -83,8 +83,9 @@ def driverobj(config, cycle): # Tests -def test_ChgresCube(): - for method in [ +@mark.parametrize( + "method", + [ "_driver_config", "_resources", "_run_via_batch_submission", @@ -97,8 +98,10 @@ def test_ChgresCube(): "_validate", "_write_runscript", "run", - ]: - assert getattr(ChgresCube, method) is getattr(Driver, method) + ], +) +def test_ChgresCube(method): + assert getattr(ChgresCube, method) is getattr(Driver, method) def test_ChgresCube_namelist_file(caplog, driverobj): diff --git a/src/uwtools/tests/drivers/test_fv3.py b/src/uwtools/tests/drivers/test_fv3.py index 90df4b886..3c7bcc375 100644 --- a/src/uwtools/tests/drivers/test_fv3.py +++ b/src/uwtools/tests/drivers/test_fv3.py @@ -81,8 +81,9 @@ def true(): # Tests -def test_FV3(): - for method in [ +@mark.parametrize( + "method", + [ "_driver_config", "_resources", "_run_via_batch_submission", @@ -95,8 +96,10 @@ def test_FV3(): "_validate", "_write_runscript", "run", - ]: - assert getattr(FV3, method) is getattr(Driver, method) + ], +) +def test_FV3(method): + assert getattr(FV3, method) is getattr(Driver, method) def test_FV3_boundary_files(driverobj): diff --git a/src/uwtools/tests/drivers/test_global_equiv_resol.py b/src/uwtools/tests/drivers/test_global_equiv_resol.py index f7d3a265e..5ba15c5e5 100644 --- a/src/uwtools/tests/drivers/test_global_equiv_resol.py +++ b/src/uwtools/tests/drivers/test_global_equiv_resol.py @@ -6,7 +6,7 @@ from unittest.mock import DEFAULT as D from unittest.mock import patch -from pytest import fixture +from pytest import fixture, mark from uwtools.drivers.driver import Driver from uwtools.drivers.global_equiv_resol import GlobalEquivResol @@ -43,8 +43,9 @@ def driverobj(config): # Tests -def test_GlobalEquivResol(): - for method in [ +@mark.parametrize( + "method", + [ "_driver_config", "_resources", "_run_via_batch_submission", @@ -58,8 +59,10 @@ def test_GlobalEquivResol(): "_write_runscript", "run", "runscript", - ]: - assert getattr(GlobalEquivResol, method) is getattr(Driver, method) + ], +) +def test_GlobalEquivResol(method): + assert getattr(GlobalEquivResol, method) is getattr(Driver, method) def test_GlobalEquivResol_input_file(driverobj): diff --git a/src/uwtools/tests/drivers/test_jedi.py b/src/uwtools/tests/drivers/test_jedi.py index 26a79929f..b0bdd4d6b 100644 --- a/src/uwtools/tests/drivers/test_jedi.py +++ b/src/uwtools/tests/drivers/test_jedi.py @@ -10,7 +10,7 @@ import yaml from iotaa import asset, external -from pytest import fixture +from pytest import fixture, mark from uwtools.config.formats.yaml import YAMLConfig from uwtools.drivers import jedi, jedi_base @@ -77,8 +77,9 @@ def driverobj(config, cycle): # Tests -def test_JEDI(): - for method in [ +@mark.parametrize( + "method", + [ "_driver_config", "_resources", "_run_via_batch_submission", @@ -91,8 +92,10 @@ def test_JEDI(): "_write_runscript", "run", "runscript", - ]: - assert getattr(JEDI, method) is getattr(JEDIBase, method) + ], +) +def test_JEDI(method): + assert getattr(JEDI, method) is getattr(JEDIBase, method) def test_JEDI_configuration_file(driverobj): diff --git a/src/uwtools/tests/drivers/test_make_solo_mosaic.py b/src/uwtools/tests/drivers/test_make_solo_mosaic.py index 2d297fcdf..f1c134fce 100644 --- a/src/uwtools/tests/drivers/test_make_solo_mosaic.py +++ b/src/uwtools/tests/drivers/test_make_solo_mosaic.py @@ -4,7 +4,7 @@ """ from unittest.mock import patch -from pytest import fixture +from pytest import fixture, mark from uwtools.drivers.driver import Driver from uwtools.drivers.make_solo_mosaic import MakeSoloMosaic @@ -44,8 +44,9 @@ def driverobj(config): # Tests -def test_MakeSoloMosaic(): - for method in [ +@mark.parametrize( + "method", + [ "_driver_config", "_resources", "_run_via_batch_submission", @@ -58,8 +59,10 @@ def test_MakeSoloMosaic(): "_write_runscript", "run", "runscript", - ]: - assert getattr(MakeSoloMosaic, method) is getattr(Driver, method) + ], +) +def test_MakeSoloMosaic(method): + assert getattr(MakeSoloMosaic, method) is getattr(Driver, method) def test_MakeSoloMosaic_provisioned_run_directory(driverobj): diff --git a/src/uwtools/tests/drivers/test_mpas.py b/src/uwtools/tests/drivers/test_mpas.py index cda052d83..f1ca3fffa 100644 --- a/src/uwtools/tests/drivers/test_mpas.py +++ b/src/uwtools/tests/drivers/test_mpas.py @@ -117,8 +117,9 @@ def driverobj(config, cycle): # Tests -def test_MPAS(): - for method in [ +@mark.parametrize( + "method", + [ "_driver_config", "_resources", "_run_via_batch_submission", @@ -134,8 +135,10 @@ def test_MPAS(): "run", "runscript", "streams_file", - ]: - assert getattr(MPAS, method) is getattr(MPASBase, method) + ], +) +def test_MPAS(method): + assert getattr(MPAS, method) is getattr(MPASBase, method) def test_MPAS_boundary_files(driverobj, cycle): @@ -148,9 +151,8 @@ def test_MPAS_boundary_files(driverobj, cycle): infile_path = Path(driverobj._driver_config["lateral_boundary_conditions"]["path"]) infile_path.mkdir() for n in ns: - ( - infile_path / f"lbc.{(cycle+dt.timedelta(hours=n)).strftime('%Y-%m-%d_%H.%M.%S')}.nc" - ).touch() + path = infile_path / f"lbc.{(cycle+dt.timedelta(hours=n)).strftime('%Y-%m-%d_%H.%M.%S')}.nc" + path.touch() driverobj.boundary_files() assert all(link.is_symlink() for link in links) diff --git a/src/uwtools/tests/drivers/test_mpas_init.py b/src/uwtools/tests/drivers/test_mpas_init.py index daa4b228a..a3af38cca 100644 --- a/src/uwtools/tests/drivers/test_mpas_init.py +++ b/src/uwtools/tests/drivers/test_mpas_init.py @@ -99,8 +99,9 @@ def driverobj(config, cycle): # Tests -def test_MPASInit(): - for method in [ +@mark.parametrize( + "method", + [ "_driver_config", "_resources", "_run_via_batch_submission", @@ -116,8 +117,10 @@ def test_MPASInit(): "run", "runscript", "streams_file", - ]: - assert getattr(MPASInit, method) is getattr(MPASBase, method) + ], +) +def test_MPASInit(method): + assert getattr(MPASInit, method) is getattr(MPASBase, method) def test_MPASInit_boundary_files(cycle, driverobj): diff --git a/src/uwtools/tests/drivers/test_orog_gsl.py b/src/uwtools/tests/drivers/test_orog_gsl.py index b9b17f99d..ba15bb606 100644 --- a/src/uwtools/tests/drivers/test_orog_gsl.py +++ b/src/uwtools/tests/drivers/test_orog_gsl.py @@ -6,7 +6,7 @@ from unittest.mock import DEFAULT as D from unittest.mock import patch -from pytest import fixture +from pytest import fixture, mark from uwtools.drivers.driver import Driver from uwtools.drivers.orog_gsl import OrogGSL @@ -51,8 +51,9 @@ def driverobj(config): # Tests -def test_OrogGSL(): - for method in [ +@mark.parametrize( + "method", + [ "_driver_config", "_resources", "_run_via_batch_submission", @@ -66,8 +67,10 @@ def test_OrogGSL(): "_write_runscript", "run", "runscript", - ]: - assert getattr(OrogGSL, method) is getattr(Driver, method) + ], +) +def test_OrogGSL(method): + assert getattr(OrogGSL, method) is getattr(Driver, method) def test_OrogGSL_input_grid_file(driverobj): diff --git a/src/uwtools/tests/drivers/test_ungrib.py b/src/uwtools/tests/drivers/test_ungrib.py index e5e5bc3eb..3265c22a7 100644 --- a/src/uwtools/tests/drivers/test_ungrib.py +++ b/src/uwtools/tests/drivers/test_ungrib.py @@ -7,7 +7,7 @@ from unittest.mock import patch import f90nml # type: ignore -from pytest import fixture +from pytest import fixture, mark from uwtools.drivers import ungrib from uwtools.drivers.driver import Driver @@ -56,8 +56,9 @@ def driverobj(config, cycle): # Tests -def test_Ungrib(): - for method in [ +@mark.parametrize( + "method", + [ "_driver_config", "_resources", "_run_via_batch_submission", @@ -71,8 +72,10 @@ def test_Ungrib(): "_write_runscript", "run", "runscript", - ]: - assert getattr(Ungrib, method) is getattr(Driver, method) + ], +) +def test_Ungrib(method): + assert getattr(Ungrib, method) is getattr(Driver, method) def test_Ungrib_gribfiles(driverobj, tmp_path): diff --git a/src/uwtools/tests/utils/test_file.py b/src/uwtools/tests/utils/test_file.py index 560a50a4f..1151e5493 100644 --- a/src/uwtools/tests/utils/test_file.py +++ b/src/uwtools/tests/utils/test_file.py @@ -9,7 +9,7 @@ from pathlib import Path from unittest.mock import patch -from pytest import fixture, raises +from pytest import fixture, mark, raises from uwtools.exceptions import UWError from uwtools.utils import file @@ -58,8 +58,9 @@ def test__stdinproxy(): assert file._stdinproxy().read() == msg1 # <-- the NEW message -def test_get_file_format(): - for ext, file_type in { +@mark.parametrize( + "ext,file_type", + { "atparse": "atparse", "bash": "sh", "cfg": "ini", @@ -70,8 +71,10 @@ def test_get_file_format(): "sh": "sh", "yaml": "yaml", "yml": "yaml", - }.items(): - assert file.get_file_format(Path(f"a.{ext}")) == file_type + }.items(), +) +def test_get_file_format(ext, file_type): + assert file.get_file_format(Path(f"a.{ext}")) == file_type def test_get_file_format_unrecognized():