Skip to content

Commit caa4960

Browse files
committed
tests: Fix return value of a test
We don't actually want to return anything here: just make sure download_file() gets executed Signed-off-by: Jussi Kukkonen <[email protected]>
1 parent 7c638b0 commit caa4960

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/test_fetcher_ng.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
import sys
1111
import tempfile
1212
import unittest
13-
from collections.abc import Iterator
14-
from typing import Any, ClassVar
13+
from typing import ClassVar
1514
from unittest.mock import Mock, patch
1615

1716
import requests
@@ -163,11 +162,11 @@ def test_download_file_upper_length(self) -> None:
163162
self.assertEqual(self.file_length, temp_file.tell())
164163

165164
# Download a file bigger than expected
166-
def test_download_file_length_mismatch(self) -> Iterator[Any]:
167-
with self.assertRaises(exceptions.DownloadLengthMismatchError):
168-
# Force download_file to execute and raise the error since it is a
169-
# context manager and returns Iterator[IO]
170-
yield self.fetcher.download_file(self.url, self.file_length - 4)
165+
def test_download_file_length_mismatch(self) -> None:
166+
with self.assertRaises(
167+
exceptions.DownloadLengthMismatchError
168+
), self.fetcher.download_file(self.url, self.file_length - 4):
169+
pass # we never get here as download_file() raises
171170

172171

173172
# Run unit test.

0 commit comments

Comments
 (0)