Skip to content

Commit

Permalink
Fix ignores in test_{scanner,file_downloader}.py
Browse files Browse the repository at this point in the history
python/mypy#2427 (comment)
describes the mypy change, in mypy 1.1.0
  • Loading branch information
David Robertson committed Nov 24, 2023
1 parent 2774651 commit 65b6d1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/scanner/test_file_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async def _get(

# Mock _get so we don't actually try to download files.
self.get_mock = Mock(side_effect=_get)
self.downloader._get = self.get_mock # type: ignore[assignment]
self.downloader._get = self.get_mock # type: ignore[method-assign]

async def test_download(self) -> None:
"""Tests that downloading a file works."""
Expand Down Expand Up @@ -230,7 +230,7 @@ async def _get(

# Mock _get so we don't actually try to download files.
self.get_mock = Mock(side_effect=_get)
self.downloader._get = self.get_mock # type: ignore[assignment]
self.downloader._get = self.get_mock # type: ignore[method-assign]

async def test_discover(self) -> None:
"""Checks that the base URL to use to download files can be discovered via
Expand Down
8 changes: 4 additions & 4 deletions tests/scanner/test_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def download_file(

# Mock download_file so we don't actually try to download files.
mcs = get_content_scanner()
mcs.file_downloader.download_file = self.downloader_mock # type: ignore[assignment]
mcs.file_downloader.download_file = self.downloader_mock # type: ignore[method-assign]
self.scanner = mcs.scanner

async def test_scan(self) -> None:
Expand Down Expand Up @@ -161,7 +161,7 @@ async def test_cache_max_size_mismatching_hash(self) -> None:
"""
# Mock the _run_scan command so we can keep track of its call count.
mock_runner = Mock(return_value=0)
self.scanner._run_scan = mock_runner # type: ignore[assignment]
self.scanner._run_scan = mock_runner # type: ignore[method-assign]

# Calculate the cache key for this file so we can look it up later.
cache_key = self.scanner._get_cache_key_for_file(MEDIA_PATH, None, None)
Expand Down Expand Up @@ -269,7 +269,7 @@ async def test_dont_cache_exit_codes(self) -> None:
# It's tricky to give a value to `scanner._script` that makes `_run_scan` return 5
# directly, so we just mock it here.
run_scan_mock = Mock(return_value=5)
self.scanner._run_scan = run_scan_mock # type: ignore[assignment]
self.scanner._run_scan = run_scan_mock # type: ignore[method-assign]

# Scan the file, we'll check later that it wasn't cached.
with self.assertRaises(FileDirtyError):
Expand Down Expand Up @@ -318,7 +318,7 @@ async def _scan_file(*args: Any) -> MediaDescription:
return self.downloader_res

scan_mock = Mock(side_effect=_scan_file)
self.scanner._scan_file = scan_mock # type: ignore[assignment]
self.scanner._scan_file = scan_mock # type: ignore[method-assign]

# Request two scans of the same file at the same time.
results = await asyncio.gather(
Expand Down

0 comments on commit 65b6d1e

Please sign in to comment.