Skip to content

Commit

Permalink
Remove stray os.path references from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-white committed Dec 11, 2024
1 parent d2c72e6 commit 65d9741
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tests/e2e/test_end_to_end.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
from pathlib import Path

import intake
import numpy as np
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"


Expand All @@ -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
"""
Expand Down

0 comments on commit 65d9741

Please sign in to comment.