diff --git a/tests/e2e/test_end_to_end.py b/tests/e2e/test_end_to_end.py index 05262f7..bec1f8e 100644 --- a/tests/e2e/test_end_to_end.py +++ b/tests/e2e/test_end_to_end.py @@ -1,4 +1,4 @@ -import os +from pathlib import Path import intake import numpy as np @@ -41,14 +41,14 @@ def metacat(BASE_DIR, config_dir, v_num): "--no_update", ] ) - cat_path = os.path.join(BASE_DIR, v_num, "metacatalog.csv") + cat_path = Path(BASE_DIR) / v_num / "metacatalog.csv" metacat = intake.open_df_catalog(cat_path) yield metacat @e2e def test_catalog_subset_exists(BASE_DIR, v_num, metacat): - assert os.path.exists(os.path.join(BASE_DIR, v_num, "metacatalog.csv")) + assert (Path(BASE_DIR) / v_num / "metacatalog.csv").exists() @e2e diff --git a/tests/test_utils.py b/tests/test_utils.py index c3e8eec..bb3440d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -216,7 +216,7 @@ def test_bad_metadata_validation_raises(test_data, instance, no_errs, bad_kw): assert f"| {kw}" in err_msg, f"Can't see expected specific error for {kw}" -@mock.patch("os.path.isfile") +@mock.patch("pathlib.Path.is_file") @pytest.mark.parametrize("isfile_return", [True, False]) @pytest.mark.parametrize( "basepath", @@ -225,8 +225,8 @@ def test_bad_metadata_validation_raises(test_data, instance, no_errs, bad_kw): Path("/path/like/string"), ], ) -def test_get_catalog_fp_basepath(mock_isfile, isfile_return, basepath): - mock_isfile.return_value = isfile_return +def test_get_catalog_fp_basepath(mock_is_file, isfile_return, basepath): + mock_is_file.return_value = isfile_return assert str(get_catalog_fp(basepath=basepath)) == "/path/like/string/catalog.yaml" @@ -238,8 +238,8 @@ def test_get_catalog_fp_local(mock_is_file): assert str(get_catalog_fp()) == USER_CATALOG_LOCATION -@mock.patch("os.path.isfile", return_value=False) -def test_get_catalog_fp_xp65(mock_isfile): +@mock.patch("pathlib.Path.is_file", return_value=False) +def test_get_catalog_fp_xp65(mock_is_file): """ Check that we get pointed back to the user catalog """