diff --git a/.github/workflows/ci_tools_map_syncer.yaml b/.github/workflows/ci_tools_map_syncer.yaml index 14f8c27..34e2033 100644 --- a/.github/workflows/ci_tools_map_syncer.yaml +++ b/.github/workflows/ci_tools_map_syncer.yaml @@ -38,6 +38,6 @@ jobs: - name: Check Types run: mypy - name: Lint - run: ruff . --format=github + run: ruff check --output-format=github . - name: Test run: pytest diff --git a/tools/map_syncer/map_syncer.py b/tools/map_syncer/map_syncer.py index 0842179..9cc3bd7 100755 --- a/tools/map_syncer/map_syncer.py +++ b/tools/map_syncer/map_syncer.py @@ -182,7 +182,7 @@ class SyncOp(Enum): STOP = 2 -if TYPE_CHECKING: # noqa: SIM108 +if TYPE_CHECKING: SyncQueue = queue.Queue[Tuple[SyncOp, str]] else: SyncQueue = queue.Queue diff --git a/tools/map_syncer/map_syncer_test.py b/tools/map_syncer/map_syncer_test.py index a946e24..305930d 100644 --- a/tools/map_syncer/map_syncer_test.py +++ b/tools/map_syncer/map_syncer_test.py @@ -226,7 +226,7 @@ def test_poller_starts_sync_correctly(mocker: MockerFixture) -> None: sync_trigger: map_syncer.SyncQueue = queue.Queue() t = threading.Thread( target=lambda: map_syncer.polling_sync( - pathlib.Path(""), "", 0, sync_trigger, "http://x.com/health" + pathlib.Path(), "", 0, sync_trigger, "http://x.com/health" ) ) t.start() @@ -245,7 +245,7 @@ def test_poller_catches_exceptions(mocker: MockerFixture) -> None: sync_files.side_effect = RuntimeError("test") sync_trigger: map_syncer.SyncQueue = queue.Queue() t = threading.Thread( - target=lambda: map_syncer.polling_sync(pathlib.Path(""), "", 0, sync_trigger) + target=lambda: map_syncer.polling_sync(pathlib.Path(), "", 0, sync_trigger) ) t.start() sync_trigger.put((map_syncer.SyncOp.SYNC, "A")) @@ -260,7 +260,7 @@ def test_poller_ignores_duplicate_requests(mocker: MockerFixture) -> None: sync_files = mocker.patch("map_syncer.sync_files") sync_trigger: map_syncer.SyncQueue = queue.Queue() t = threading.Thread( - target=lambda: map_syncer.polling_sync(pathlib.Path(""), "", 0, sync_trigger) + target=lambda: map_syncer.polling_sync(pathlib.Path(), "", 0, sync_trigger) ) t.start() for _ in range(10): @@ -322,7 +322,8 @@ def test_sync_files_deletes_only_old(live_maps_url: str, fs: FakeFilesystem) -> assert fs.exists(d / "map_old_1.sd7") assert not fs.exists(d / "map_old_2.sd7") assert cast( - Dict[str, int], json.loads(fs.get_object(d / "tombstones.json").contents) + Dict[str, int], + json.loads(fs.get_object(d / "tombstones.json").contents or "{}"), ) == { "map_old_1.sd7": initial_tombstones["map_old_1.sd7"], } diff --git a/tools/map_syncer/requirements.txt b/tools/map_syncer/requirements.txt index 28682ee..3423904 100644 --- a/tools/map_syncer/requirements.txt +++ b/tools/map_syncer/requirements.txt @@ -1,11 +1,11 @@ -black>=23.3.0 -isort>=5.12.0 -mypy>=1.4.1 +black==23.11.0 +isort==5.12.0 +mypy==1.7.1 paho-mqtt>=1.6.1 -pyfakefs>=5.2.2 +pyfakefs>=5.3.1 pytest-httpserver>=1.0.8 -pytest-mock>=3.11.1 -pytest-mqtt>=0.2.0 -pytest>=7.4.0 -ruff>=0.0.277 -types-paho-mqtt>=1.6.0.6 +pytest-mock>=3.12.0 +pytest-mqtt>=0.3.1 +pytest>=7.4.3 +ruff==0.1.6 +types-paho-mqtt>=1.6.0.7