diff --git a/idaes/apps/grid_integration/tests/test_integration.py b/idaes/apps/grid_integration/tests/test_integration.py index 26e9ad0830..3de0101920 100644 --- a/idaes/apps/grid_integration/tests/test_integration.py +++ b/idaes/apps/grid_integration/tests/test_integration.py @@ -51,7 +51,9 @@ def data_path(self) -> Path: # where importlib.resources.path() requires the resource to be a file # directories are not supported and will raise an error if attempted - with as_file(files("idaes.tests.prescient.5bus").joinpath("__init__.py")) as pkg_file: + fname = "idaes.tests.prescient.5bus" + py_fname = "__init__.py" + with as_file(files(fname).joinpath(py_fname)) as pkg_file: prescient_5bus = Path(pkg_file).parent @@ -73,7 +75,9 @@ def self_scheduler_output_dir(self, tmp_path: Path) -> Path: @pytest.fixture def self_scheduler_plugin_path(self) -> Path: - with as_file(files("idaes.apps.grid_integration.tests").joinpath("self_scheduler_integration_test_plugin.py")) as p: + fname = "idaes.apps.grid_integration.tests" + py_fname = "self_scheduler_integration_test_plugin.py" + with as_file(files(fname).joinpath(py_fname)) as p: return Path(p) @pytest.mark.unit diff --git a/idaes/tests/prescient/test_prescient.py b/idaes/tests/prescient/test_prescient.py index cf04d7e681..7ef1c71801 100644 --- a/idaes/tests/prescient/test_prescient.py +++ b/idaes/tests/prescient/test_prescient.py @@ -33,7 +33,9 @@ def data_path(self) -> Path: # we need to specify __init__.py as a workaround for Python 3.9, # where importlib.resources.path() requires the resource to be a file # directories are not supported and will raise an error if attempted - with as_file(files("idaes.tests.prescient.5bus").joinpath("__init__.py")) as pkg_file: + fname = "idaes.tests.prescient.5bus" + py_fname = "__init__.py" + with as_file(files(fname).joinpath(py_fname)) as pkg_file: prescient_5bus = Path(pkg_file).parent @pytest.mark.unit