Island: Replace joinpath() with /

This commit is contained in:
Mike Salvatore 2021-10-20 13:48:19 -04:00
parent 9b005255f1
commit f17183a76a
2 changed files with 8 additions and 8 deletions

View File

@ -6,10 +6,10 @@ _version_filename = "VERSION"
def get_version_from_dir(dir_path: Path) -> str: def get_version_from_dir(dir_path: Path) -> str:
version_file_path = dir_path.joinpath(_version_filename) version_file_path = dir_path / _version_filename
return version_file_path.read_text() return version_file_path.read_text()
def write_version(dir_path: Path): def write_version(dir_path: Path):
version_file_path = dir_path.joinpath(_version_filename) version_file_path = dir_path / _version_filename
version_file_path.write_text(get_version()) version_file_path.write_text(get_version())

View File

@ -18,13 +18,13 @@ def mock_version(monkeypatch):
@pytest.fixture @pytest.fixture
def temp_data_dir_path(tmpdir) -> Path: def temp_data_dir_path(tmp_path) -> Path:
return Path(tmpdir, "data_dir") return tmp_path / "data_dir"
@pytest.fixture @pytest.fixture
def temp_version_file_path(temp_data_dir_path) -> Path: def temp_version_file_path(temp_data_dir_path) -> Path:
return temp_data_dir_path.joinpath(_version_filename) return temp_data_dir_path / _version_filename
def test_setup_data_dir(temp_data_dir_path, temp_version_file_path): def test_setup_data_dir(temp_data_dir_path, temp_version_file_path):
@ -41,7 +41,7 @@ def test_old_version_removed(monkeypatch, temp_data_dir_path, temp_version_file_
temp_data_dir_path.mkdir() temp_data_dir_path.mkdir()
temp_version_file_path.write_text(old_version) temp_version_file_path.write_text(old_version)
bogus_file_path = temp_data_dir_path.joinpath("test.txt") bogus_file_path = temp_data_dir_path / "test.txt"
bogus_file_path.touch() bogus_file_path.touch()
setup_data_dir(temp_data_dir_path) setup_data_dir(temp_data_dir_path)
@ -58,7 +58,7 @@ def test_old_version_not_removed(
temp_data_dir_path.mkdir() temp_data_dir_path.mkdir()
temp_version_file_path.write_text(old_version) temp_version_file_path.write_text(old_version)
bogus_file_path = temp_data_dir_path.joinpath("test.txt") bogus_file_path = temp_data_dir_path / "test.txt"
bogus_file_path.touch() bogus_file_path.touch()
with pytest.raises(IncompatibleDataDirectory): with pytest.raises(IncompatibleDataDirectory):
@ -71,7 +71,7 @@ def test_old_version_not_removed(
def test_data_dir_setup_not_needed(temp_data_dir_path, temp_version_file_path): def test_data_dir_setup_not_needed(temp_data_dir_path, temp_version_file_path):
temp_data_dir_path.mkdir() temp_data_dir_path.mkdir()
temp_version_file_path.write_text(current_version) temp_version_file_path.write_text(current_version)
bogus_file_path = temp_data_dir_path.joinpath("test.txt") bogus_file_path = temp_data_dir_path / "test.txt"
bogus_file_path.touch() bogus_file_path.touch()
setup_data_dir(temp_data_dir_path) setup_data_dir(temp_data_dir_path)