From 42311e847fb2bbaaa6252da154215c5c98dc23f3 Mon Sep 17 00:00:00 2001 From: Jakub Boukal Date: Tue, 25 Jan 2022 00:56:17 +0100 Subject: [PATCH 01/11] Init assert_called --- README.rst | 3 ++ aioresponses/core.py | 89 ++++++++++++++++++++++++++++++++++++++ requirements-dev.txt | 3 +- tests/test_aioresponses.py | 70 ++++++++++++++++++++++++++++++ 4 files changed, 164 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index e2b6128..7fd5605 100644 --- a/README.rst +++ b/README.rst @@ -66,6 +66,7 @@ Supported HTTP methods: **GET**, **POST**, **PUT**, **PATCH**, **DELETE** and ** resp = loop.run_until_complete(session.get('http://example.com')) assert resp.status == 200 + mocked.assert_called_once_with('http://example.com') for convenience use *payload* argument to mock out json response. Example below. @@ -88,6 +89,7 @@ for convenience use *payload* argument to mock out json response. Example below. data = loop.run_until_complete(resp.json()) assert dict(foo='bar') == data + m.assert_called_once_with('http://test.example.com') **aioresponses allows to mock out any HTTP headers** @@ -112,6 +114,7 @@ for convenience use *payload* argument to mock out json response. Example below. # note that we pass 'connection' but get 'Connection' (capitalized) # under the neath `multidict` is used to work with HTTP headers assert resp.headers['Connection'] == 'keep-alive' + m.assert_called_once_with('http://example.com', method='POST') **allows to register different responses for the same url** diff --git a/aioresponses/core.py b/aioresponses/core.py index 560377e..233c237 100644 --- a/aioresponses/core.py +++ b/aioresponses/core.py @@ -331,6 +331,95 @@ def add(self, url: 'Union[URL, str, Pattern]', method: str = hdrs.METH_GET, callback=callback, )) + def _format_call_signature(self, *args, **kwargs): + message = '%s(%%s)' % self.__class__.__name__ or 'mock' + formatted_args = '' + args_string = ', '.join([repr(arg) for arg in args]) + kwargs_string = ', '.join([ + '%s=%r' % (key, value) for key, value in kwargs.items() + ]) + if args_string: + formatted_args = args_string + if kwargs_string: + if formatted_args: + formatted_args += ', ' + formatted_args += kwargs_string + + return message % formatted_args + + def assert_not_called(self): + """assert that the mock was never called. + """ + if len(self.requests) != 0: + msg = ("Expected '%s' to not have been called. Called %s times." + % (self.__class__.__name__, + len(self._responses))) + raise AssertionError(msg) + + def assert_called(self): + """assert that the mock was called at least once. + """ + if len(self.requests) == 0: + msg = ("Expected '%s' to have been called." + % (self.__class__.__name__,)) + raise AssertionError(msg) + + def assert_called_once(self): + """assert that the mock was called only once. + """ + if not len(self.requests) == 1 or \ + not len(list(self.requests.values())[0]) == 1: + msg = ("Expected '%s' to have been called once. Called %s times." + % (self.__class__.__name__, + len(self.requests))) + + raise AssertionError(msg) + + def assert_called_with(self, url, method='GET', *args, **kwargs): + """assert that the last call was made with the specified arguments. + + Raises an AssertionError if the args and keyword args passed in are + different to the last call to the mock.""" + url = normalize_url(merge_params(url, kwargs.get('params'))) + method = method.upper() + key = (method, url) + try: + self.requests[key] + # TODO assert args were in calls + except KeyError: + expected_string = self._format_call_signature( + url, method=method, *args, **kwargs + ) + raise AssertionError( + '%s call not found' % expected_string + ) + + def assert_any_call(self, url, method='GET', *args, **kwargs): + """assert the mock has been called with the specified arguments. + The assert passes if the mock has *ever* been called, unlike + `assert_called_with` and `assert_called_once_with` that only pass if + the call is the most recent one.""" + url = normalize_url(merge_params(url, kwargs.get('params'))) + method = method.upper() + key = (method, url) + + try: + self.requests[key] + except KeyError: + expected_string = self._format_call_signature( + url, method=method, *args, **kwargs + ) + raise AssertionError( + '%s call not found' % expected_string + ) + + def assert_called_once_with(self, *args, **kwargs): + """assert that the mock was called once with the specified arguments. + Raises an AssertionError if the args and keyword args passed in are + different to the only call to the mock.""" + self.assert_called_once() + self.assert_called_with(*args, **kwargs) + @staticmethod def is_exception(resp_or_exc: Union[ClientResponse, Exception]) -> bool: if inspect.isclass(resp_or_exc): diff --git a/requirements-dev.txt b/requirements-dev.txt index 323a80c..77fdb1f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -9,4 +9,5 @@ pytest-cov==2.10.1 pytest-html==2.1.1 ddt==1.4.1 typing -asynctest==0.13.0 \ No newline at end of file +asynctest==0.13.0 +yarl==1.7.2 diff --git a/tests/test_aioresponses.py b/tests/test_aioresponses.py index 4bb8b78..cab63c2 100644 --- a/tests/test_aioresponses.py +++ b/tests/test_aioresponses.py @@ -143,6 +143,9 @@ async def test_returned_instance_and_params_handling(self, m): ) self.assertIsInstance(response, ClientResponse) self.assertEqual(response.status, 200) + self.assertEqual(len(m.requests), 2) + with self.assertRaises(AssertionError): + m.assert_called_once() @aioresponses() def test_method_dont_match(self, m): @@ -150,6 +153,19 @@ def test_method_dont_match(self, m): with self.assertRaises(ClientConnectionError): self.run_async(self.session.post(self.url)) + @aioresponses() + def test_post_with_data(self, m: aioresponses): + payload = {"spam": "eggs"} + m.post( + self.url, + payload=payload, + headers=dict(connection='keep-alive'), + ) + response = self.run_async(self.session.post(self.url)) + self.assertIsInstance(response, ClientResponse) + self.assertEqual(response.status, 200) + m.assert_called_once_with(self.url, method='POST') + @aioresponses() async def test_streaming(self, m): m.get(self.url, body='Test') @@ -492,6 +508,60 @@ async def callback(url, **kwargs): data = self.run_async(response.read()) assert data == body + @aioresponses() + def test_assert_not_called(self, m: aioresponses): + m.get(self.url) + m.assert_not_called() + self.run_async(self.session.get(self.url)) + with self.assertRaises(AssertionError): + m.assert_not_called() + + @aioresponses() + def test_assert_called(self, m: aioresponses): + m.get(self.url) + with self.assertRaises(AssertionError): + m.assert_called() + self.run_async(self.session.get(self.url)) + + m.assert_called_once() + m.assert_called_once_with(self.url) + m.assert_called_with(self.url) + with self.assertRaises(AssertionError): + m.assert_not_called() + + with self.assertRaises(AssertionError): + m.assert_called_with("http://foo.bar") + + @aioresponses() + async def test_assert_called_twice(self, m: aioresponses): + m.get(self.url, repeat=True) + m.assert_not_called() + await self.session.get(self.url) + await self.session.get(self.url) + with self.assertRaises(AssertionError): + m.assert_called_once() + + @aioresponses() + async def test_assert_any_call(self, m: aioresponses): + http_bin_url = "http://httpbin.org" + m.get(self.url) + m.get(http_bin_url) + await self.session.get(self.url) + response = await self.session.get(http_bin_url) + self.assertEqual(response.status, 200) + m.assert_any_call(self.url) + m.assert_any_call(http_bin_url) + + @aioresponses() + async def test_assert_any_call_not_called(self, m: aioresponses): + http_bin_url = "http://httpbin.org" + m.get(self.url) + response = await self.session.get(self.url) + self.assertEqual(response.status, 200) + m.assert_any_call(self.url) + with self.assertRaises(AssertionError): + m.assert_any_call(http_bin_url) + @aioresponses() async def test_exception_requests_are_tracked(self, mocked): kwargs = {"json": [42], "allow_redirects": True} From a8eddb865bbdb0816d974a0ec63bdb62bfcf7f91 Mon Sep 17 00:00:00 2001 From: Jakub Boukal Date: Wed, 26 Jan 2022 23:26:45 +0100 Subject: [PATCH 02/11] Extend for arguments --- aioresponses/core.py | 60 ++++++++++++++++++++++++++++---------- tests/test_aioresponses.py | 46 +++++++++++++++++++++++++++-- 2 files changed, 88 insertions(+), 18 deletions(-) diff --git a/aioresponses/core.py b/aioresponses/core.py index 233c237..dbf9558 100644 --- a/aioresponses/core.py +++ b/aioresponses/core.py @@ -331,7 +331,7 @@ def add(self, url: 'Union[URL, str, Pattern]', method: str = hdrs.METH_GET, callback=callback, )) - def _format_call_signature(self, *args, **kwargs): + def _format_call_signature(self, *args, **kwargs) -> str: message = '%s(%%s)' % self.__class__.__name__ or 'mock' formatted_args = '' args_string = ', '.join([repr(arg) for arg in args]) @@ -367,15 +367,20 @@ def assert_called(self): def assert_called_once(self): """assert that the mock was called only once. """ - if not len(self.requests) == 1 or \ - not len(list(self.requests.values())[0]) == 1: + call_count = len(self.requests) + if call_count == 1: + call_count = len(list(self.requests.values())[0]) + if not call_count == 1: msg = ("Expected '%s' to have been called once. Called %s times." % (self.__class__.__name__, - len(self.requests))) + call_count)) raise AssertionError(msg) - def assert_called_with(self, url, method='GET', *args, **kwargs): + def assert_called_with(self, url: 'Union[URL, str, Pattern]', + method: str = hdrs.METH_GET, + *args: Any, + **kwargs: Any): """assert that the last call was made with the specified arguments. Raises an AssertionError if the args and keyword args passed in are @@ -384,8 +389,7 @@ def assert_called_with(self, url, method='GET', *args, **kwargs): method = method.upper() key = (method, url) try: - self.requests[key] - # TODO assert args were in calls + expected = self.requests[key][-1] except KeyError: expected_string = self._format_call_signature( url, method=method, *args, **kwargs @@ -393,8 +397,22 @@ def assert_called_with(self, url, method='GET', *args, **kwargs): raise AssertionError( '%s call not found' % expected_string ) + actual = self._build_request_call(method, *args, **kwargs) + if not expected == actual: + expected_string = self._format_call_signature( + expected, + ) + actual_string = self._format_call_signature( + actual + ) + raise AssertionError( + '%s != %s' % (expected_string, actual_string) + ) - def assert_any_call(self, url, method='GET', *args, **kwargs): + def assert_any_call(self, url: 'Union[URL, str, Pattern]', + method: str = hdrs.METH_GET, + *args: Any, + **kwargs: Any): """assert the mock has been called with the specified arguments. The assert passes if the mock has *ever* been called, unlike `assert_called_with` and `assert_called_once_with` that only pass if @@ -413,7 +431,7 @@ def assert_any_call(self, url, method='GET', *args, **kwargs): '%s call not found' % expected_string ) - def assert_called_once_with(self, *args, **kwargs): + def assert_called_once_with(self, *args: Any, **kwargs: Any): """assert that the mock was called once with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the only call to the mock.""" @@ -491,12 +509,8 @@ async def _request_mock(self, orig_self: ClientSession, key = (method, url) self.requests.setdefault(key, []) - try: - kwargs_copy = copy.deepcopy(kwargs) - except (TypeError, ValueError): - # Handle the fact that some values cannot be deep copied - kwargs_copy = kwargs - self.requests[key].append(RequestCall(args, kwargs_copy)) + request_call = self._build_request_call(method, *args, **kwargs) + self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) @@ -520,3 +534,19 @@ async def _request_mock(self, orig_self: ClientSession, response.raise_for_status() return response + + def _build_request_call(self, method: str = hdrs.METH_GET, + *args: Any, + allow_redirects: bool = True, + **kwargs: Any): + """Return request call.""" + kwargs.setdefault('allow_redirects', allow_redirects) + if method == 'POST': + kwargs.setdefault('data', None) + + try: + kwargs_copy = copy.deepcopy(kwargs) + except (TypeError, ValueError): + # Handle the fact that some values cannot be deep copied + kwargs_copy = kwargs + return RequestCall(args, kwargs_copy) diff --git a/tests/test_aioresponses.py b/tests/test_aioresponses.py index cab63c2..d0b150c 100644 --- a/tests/test_aioresponses.py +++ b/tests/test_aioresponses.py @@ -155,16 +155,56 @@ def test_method_dont_match(self, m): @aioresponses() def test_post_with_data(self, m: aioresponses): - payload = {"spam": "eggs"} + body = {'foo': 'bar'} + payload = {'spam': 'eggs'} + user_agent = {'User-Agent': 'aioresponses'} m.post( self.url, payload=payload, headers=dict(connection='keep-alive'), + body=body, + ) + response = self.run_async( + self.session.post( + self.url, + data=payload, + headers=user_agent + ) ) - response = self.run_async(self.session.post(self.url)) self.assertIsInstance(response, ClientResponse) self.assertEqual(response.status, 200) - m.assert_called_once_with(self.url, method='POST') + response_data = self.run_async(response.json()) + self.assertEqual(response_data, payload) + m.assert_called_once_with( + self.url, + method='POST', + data=payload, + headers={'User-Agent': 'aioresponses'} + ) + # Wrong data + with self.assertRaises(AssertionError): + m.assert_called_once_with( + self.url, + method='POST', + data=body, + headers={'User-Agent': 'aioresponses'} + ) + # Wrong url + with self.assertRaises(AssertionError): + m.assert_called_once_with( + 'http://httpbin.org/', + method='POST', + data=payload, + headers={'User-Agent': 'aioresponses'} + ) + # Wrong headers + with self.assertRaises(AssertionError): + m.assert_called_once_with( + self.url, + method='POST', + data=payload, + headers={'User-Agent': 'aiorequest'} + ) @aioresponses() async def test_streaming(self, m): From 60851b4f09acc76280c747dfadf9d64fd3cf3046 Mon Sep 17 00:00:00 2001 From: konstantin Date: Sat, 12 Mar 2022 11:04:47 +0100 Subject: [PATCH 03/11] ignore false positive mypy warning when `url_or_pattern` is a `Pattern` Ignore: aioresponses\core.py:113: error: Item "URL" of "Union[URL, Pattern[Any]]" has no attribute "match" [union-attr] --- aioresponses/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aioresponses/core.py b/aioresponses/core.py index 560377e..344e2a9 100644 --- a/aioresponses/core.py +++ b/aioresponses/core.py @@ -110,7 +110,8 @@ def match_str(self, url: URL) -> bool: return self.url_or_pattern == url def match_regexp(self, url: URL) -> bool: - return bool(self.url_or_pattern.match(str(url))) + # This method is used if and only if self.url_or_pattern is actually a pattern. + return bool(self.url_or_pattern.match(str(url))) # type:ignore[union-attr] def match(self, method: str, url: URL) -> bool: if self.method != method.lower(): From f63af7c364a630a76d5e5feedc485f91da455294 Mon Sep 17 00:00:00 2001 From: konstantin Date: Sat, 12 Mar 2022 11:14:49 +0100 Subject: [PATCH 04/11] Avoid type confusion by explicitly typing as `ClientResponse` Fixes: aioresponses\core.py:367: error: Item "Exception" of "Union[ClientResponse, Exception]" has no attribute "status" [union-attr] aioresponses\core.py:369: error: Argument 1 to "__get__" of "reify" has incompatible type "Union[ClientResponse, Exception]"; expected "_TSelf[CIMu ltiDictProxy[str]]" [arg-type] aioresponses\core.py:369: error: Item "Exception" of "Union[ClientResponse, Exception]" has no attribute "headers" [union-attr] aioresponses\core.py:372: error: Argument 1 to "__get__" of "reify" has incompatible type "Union[ClientResponse, Exception]"; expected "_TSelf[CIMu ltiDictProxy[str]]" [arg-type] aioresponses\core.py:372: error: Item "Exception" of "Union[ClientResponse, Exception]" has no attribute "headers" [union-attr] aioresponses\core.py:382: error: Item "Exception" of "Union[ClientResponse, Exception]" has no attribute "_history" [union-attr] aioresponses\core.py:384: error: Incompatible return value type (got "Union[ClientResponse, Exception]", expected "Optional[ClientResponse]") [ret urn-value] --- aioresponses/core.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/aioresponses/core.py b/aioresponses/core.py index 560377e..c4d5fbf 100644 --- a/aioresponses/core.py +++ b/aioresponses/core.py @@ -364,12 +364,15 @@ async def match( if self.is_exception(response_or_exc): raise response_or_exc - is_redirect = response_or_exc.status in (301, 302, 303, 307, 308) + # If response_or_exc was an exception, it would have been raised. + # At this point we can be sure it's a ClientResponse + response: ClientResponse = response_or_exc # type:ignore[assignment] + is_redirect = response.status in (301, 302, 303, 307, 308) if is_redirect and allow_redirects: - if hdrs.LOCATION not in response_or_exc.headers: + if hdrs.LOCATION not in response.headers: break - history.append(response_or_exc) - redirect_url = URL(response_or_exc.headers[hdrs.LOCATION]) + history.append(response) + redirect_url = URL(response.headers[hdrs.LOCATION]) if redirect_url.is_absolute(): url = redirect_url else: @@ -379,9 +382,8 @@ async def match( else: break - response_or_exc._history = tuple(history) - - return response_or_exc + response._history = tuple(history) + return response async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', From 3422e3b186810d3c08e379fd54c847756db4251c Mon Sep 17 00:00:00 2001 From: konstantin Date: Tue, 5 Apr 2022 14:43:16 +0200 Subject: [PATCH 05/11] split typing and assignment to avoid long line Fixes core.py:369:80: E501 line too long (81 > 79 characters) --- aioresponses/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aioresponses/core.py b/aioresponses/core.py index c4d5fbf..e3c0931 100644 --- a/aioresponses/core.py +++ b/aioresponses/core.py @@ -366,7 +366,8 @@ async def match( raise response_or_exc # If response_or_exc was an exception, it would have been raised. # At this point we can be sure it's a ClientResponse - response: ClientResponse = response_or_exc # type:ignore[assignment] + response: ClientResponse + response = response_or_exc # type:ignore[assignment] is_redirect = response.status in (301, 302, 303, 307, 308) if is_redirect and allow_redirects: if hdrs.LOCATION not in response.headers: From 667f88b77ebfd128e281db7b3bde185dbe440b64 Mon Sep 17 00:00:00 2001 From: konstantin Date: Tue, 5 Apr 2022 14:47:13 +0200 Subject: [PATCH 06/11] shorten comment to obey line length limit Fixes core.py:113:80: E501 line too long (87 > 79 characters) --- aioresponses/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aioresponses/core.py b/aioresponses/core.py index 344e2a9..266ade4 100644 --- a/aioresponses/core.py +++ b/aioresponses/core.py @@ -110,7 +110,7 @@ def match_str(self, url: URL) -> bool: return self.url_or_pattern == url def match_regexp(self, url: URL) -> bool: - # This method is used if and only if self.url_or_pattern is actually a pattern. + # This method is used if and only if self.url_or_pattern is a pattern. return bool(self.url_or_pattern.match(str(url))) # type:ignore[union-attr] def match(self, method: str, url: URL) -> bool: From e35ad9cbb6bf810657892f5b01c08ae53dd07a30 Mon Sep 17 00:00:00 2001 From: konstantin Date: Tue, 5 Apr 2022 14:49:11 +0200 Subject: [PATCH 07/11] fix long line by adding line breaks Fixes core.py:114:80: E501 line too long (83 > 79 characters) --- aioresponses/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aioresponses/core.py b/aioresponses/core.py index 266ade4..354e8e9 100644 --- a/aioresponses/core.py +++ b/aioresponses/core.py @@ -111,7 +111,9 @@ def match_str(self, url: URL) -> bool: def match_regexp(self, url: URL) -> bool: # This method is used if and only if self.url_or_pattern is a pattern. - return bool(self.url_or_pattern.match(str(url))) # type:ignore[union-attr] + return bool( + self.url_or_pattern.match(str(url)) # type:ignore[union-attr] + ) def match(self, method: str, url: URL) -> bool: if self.method != method.lower(): From 4e047608dae789fe4baa19553e7afbaeeb2bdd0a Mon Sep 17 00:00:00 2001 From: Fred Thomsen Date: Fri, 5 Aug 2022 16:09:40 -0400 Subject: [PATCH 08/11] Fix python versions in env list Tox does not support a `.` between major and minor versions. --- tox.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index 418b7fc..e8712e5 100644 --- a/tox.ini +++ b/tox.ini @@ -2,10 +2,10 @@ envlist = flake8, coverage, - py3.6-aiohttp{30,31,32,33,34,35,36,37} - py3.7-aiohttp{33,34,35,36,37} - py3.8-aiohttp{33,34,35,36,37} - py3.9-aiohttp{37} + py36-aiohttp{30,31,32,33,34,35,36,37} + py37-aiohttp{33,34,35,36,37} + py38-aiohttp{33,34,35,36,37} + py39-aiohttp{37} skipsdist = True [testenv:flake8] From 4de9b73acfc2bf1b726e2baa4a3834244649d978 Mon Sep 17 00:00:00 2001 From: Fred Thomsen Date: Fri, 21 Oct 2022 16:03:38 -0400 Subject: [PATCH 09/11] Adjust github actions test workflow --- .github/workflows/ci.yml | 53 +++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b86107..514b701 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ master ] +env: + python-major-version: 3 + concurrency: group: ci-${{ github.ref }}-${{ github.actor }} cancel-in-progress: true @@ -19,65 +22,65 @@ jobs: fail-fast: false matrix: include: - - python-version: 3.6 + - python-minor-version: 6 aiohttp-version: aiohttp30 - - python-version: 3.6 + - python-minor-version: 6 aiohttp-version: aiohttp31 - - python-version: 3.6 + - python-minor-version: 6 aiohttp-version: aiohttp32 - - python-version: 3.6 + - python-minor-version: 6 aiohttp-version: aiohttp33 - - python-version: 3.6 + - python-minor-version: 6 aiohttp-version: aiohttp34 - - python-version: 3.6 + - python-minor-version: 6 aiohttp-version: aiohttp35 - - python-version: 3.6 + - python-minor-version: 6 aiohttp-version: aiohttp36 - - python-version: 3.6 + - python-minor-version: 6 aiohttp-version: aiohttp37 - - python-version: 3.7 + - python-minor-version: 7 aiohttp-version: aiohttp33 - - python-version: 3.7 + - python-minor-version: 7 aiohttp-version: aiohttp34 - - python-version: 3.7 + - python-minor-version: 7 aiohttp-version: aiohttp35 - - python-version: 3.7 + - python-minor-version: 7 aiohttp-version: aiohttp36 - - python-version: 3.7 + - python-minor-version: 7 aiohttp-version: aiohttp37 - - python-version: 3.8 + - python-minor-version: 8 aiohttp-version: aiohttp33 - - python-version: 3.8 + - python-minor-version: 8 aiohttp-version: aiohttp34 - - python-version: 3.8 + - python-minor-version: 8 aiohttp-version: aiohttp35 - - python-version: 3.8 + - python-minor-version: 8 aiohttp-version: aiohttp36 - - python-version: 3.8 + - python-minor-version: 8 aiohttp-version: aiohttp37 - - python-version: 3.9 + - python-minor-version: 9 aiohttp-version: aiohttp35 - - python-version: 3.9 + - python-minor-version: 9 aiohttp-version: aiohttp36 - - python-version: 3.9 + - python-minor-version: 9 aiohttp-version: aiohttp37 steps: - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python ${{ env.python-major-version }}.${{ matrix.python-minor-version }} uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ env.python-major-version }}.${{ matrix.python-minor-version }} - name: Install Dependencies run: | python -m pip install --upgrade pip pip install tox - name: Run Tests run: | - tox -e py${{ matrix.python-version }}-${{ matrix.aiohttp-version }} + tox -e py${{ env.python-major-version }}${{ matrix.python-version }}-${{ matrix.aiohttp-version }} - uses: codecov/codecov-action@v2 with: - file: coverage.xml \ No newline at end of file + file: coverage.xml From 441032b95f9545086ff2501c8fda84d9dd222287 Mon Sep 17 00:00:00 2001 From: pnuckowski Date: Tue, 13 Dec 2022 23:55:00 +0100 Subject: [PATCH 10/11] restore 3.6 --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b86107..9ba2a80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,57 +14,78 @@ jobs: build: env: PYTEST_ADDOPTS: "--cov --cov-report=xml" - runs-on: ubuntu-latest + strategy: fail-fast: false matrix: include: - python-version: 3.6 aiohttp-version: aiohttp30 + os: ubuntu-18.04 - python-version: 3.6 aiohttp-version: aiohttp31 + os: ubuntu-18.04 - python-version: 3.6 aiohttp-version: aiohttp32 + os: ubuntu-18.04 - python-version: 3.6 aiohttp-version: aiohttp33 + os: ubuntu-18.04 - python-version: 3.6 aiohttp-version: aiohttp34 + os: ubuntu-18.04 - python-version: 3.6 aiohttp-version: aiohttp35 + os: ubuntu-18.04 - python-version: 3.6 aiohttp-version: aiohttp36 + os: ubuntu-18.04 - python-version: 3.6 aiohttp-version: aiohttp37 + os: ubuntu-18.04 - python-version: 3.7 aiohttp-version: aiohttp33 + os: ubuntu-latest - python-version: 3.7 aiohttp-version: aiohttp34 + os: ubuntu-latest - python-version: 3.7 aiohttp-version: aiohttp35 + os: ubuntu-latest - python-version: 3.7 aiohttp-version: aiohttp36 + os: ubuntu-latest - python-version: 3.7 aiohttp-version: aiohttp37 + os: ubuntu-latest - python-version: 3.8 aiohttp-version: aiohttp33 + os: ubuntu-latest - python-version: 3.8 aiohttp-version: aiohttp34 + os: ubuntu-latest - python-version: 3.8 aiohttp-version: aiohttp35 + os: ubuntu-latest - python-version: 3.8 aiohttp-version: aiohttp36 + os: ubuntu-latest - python-version: 3.8 aiohttp-version: aiohttp37 + os: ubuntu-latest - python-version: 3.9 aiohttp-version: aiohttp35 + os: ubuntu-latest - python-version: 3.9 aiohttp-version: aiohttp36 + os: ubuntu-latest - python-version: 3.9 aiohttp-version: aiohttp37 - + os: ubuntu-latest + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} From 51ac1c081bab172863659c736441173339e3d7c3 Mon Sep 17 00:00:00 2001 From: pnuckowski Date: Wed, 14 Dec 2022 00:06:51 +0100 Subject: [PATCH 11/11] bump py36 to ubuntu 20.04 --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e00095..0d2c0ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,28 +24,28 @@ jobs: include: - python-minor-version: 6 aiohttp-version: aiohttp30 - os: ubuntu-18.04 + os: ubuntu-20.04 - python-minor-version: 6 aiohttp-version: aiohttp31 - os: ubuntu-18.04 + os: ubuntu-20.04 - python-minor-version: 6 aiohttp-version: aiohttp32 - os: ubuntu-18.04 + os: ubuntu-20.04 - python-minor-version: 6 aiohttp-version: aiohttp33 - os: ubuntu-18.04 + os: ubuntu-20.04 - python-minor-version: 6 aiohttp-version: aiohttp34 - os: ubuntu-18.04 + os: ubuntu-20.04 - python-minor-version: 6 aiohttp-version: aiohttp35 - os: ubuntu-18.04 + os: ubuntu-20.04 - python-minor-version: 6 aiohttp-version: aiohttp36 - os: ubuntu-18.04 + os: ubuntu-20.04 - python-minor-version: 6 aiohttp-version: aiohttp37 - os: ubuntu-18.04 + os: ubuntu-20.04 - python-minor-version: 7 aiohttp-version: aiohttp33