From f17183a76a0f90d441f8e39c4cb0f230dc247d26 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 20 Oct 2021 13:48:19 -0400 Subject: [PATCH] Island: Replace joinpath() with / --- monkey/monkey_island/cc/setup/version_file_setup.py | 4 ++-- .../monkey_island/cc/setup/test_data_dir.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/monkey/monkey_island/cc/setup/version_file_setup.py b/monkey/monkey_island/cc/setup/version_file_setup.py index 380fcf4cc..1489ca38d 100644 --- a/monkey/monkey_island/cc/setup/version_file_setup.py +++ b/monkey/monkey_island/cc/setup/version_file_setup.py @@ -6,10 +6,10 @@ _version_filename = "VERSION" 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() 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()) diff --git a/monkey/tests/unit_tests/monkey_island/cc/setup/test_data_dir.py b/monkey/tests/unit_tests/monkey_island/cc/setup/test_data_dir.py index 696b604dc..fe60d227d 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/setup/test_data_dir.py +++ b/monkey/tests/unit_tests/monkey_island/cc/setup/test_data_dir.py @@ -18,13 +18,13 @@ def mock_version(monkeypatch): @pytest.fixture -def temp_data_dir_path(tmpdir) -> Path: - return Path(tmpdir, "data_dir") +def temp_data_dir_path(tmp_path) -> Path: + return tmp_path / "data_dir" @pytest.fixture 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): @@ -41,7 +41,7 @@ def test_old_version_removed(monkeypatch, temp_data_dir_path, temp_version_file_ temp_data_dir_path.mkdir() 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() setup_data_dir(temp_data_dir_path) @@ -58,7 +58,7 @@ def test_old_version_not_removed( temp_data_dir_path.mkdir() 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() 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): temp_data_dir_path.mkdir() 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() setup_data_dir(temp_data_dir_path)