From fc3b7f615a946fad94a84b16a8041469ca0c04ea Mon Sep 17 00:00:00 2001 From: Gabriel Ratcliff Date: Mon, 18 Sep 2023 18:07:33 -0700 Subject: [PATCH] chore: lint --- .../tests/GetProjectBaseUrl_test.py | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/packages/python/readme_metrics/tests/GetProjectBaseUrl_test.py b/packages/python/readme_metrics/tests/GetProjectBaseUrl_test.py index c62f46669b..c01702a411 100644 --- a/packages/python/readme_metrics/tests/GetProjectBaseUrl_test.py +++ b/packages/python/readme_metrics/tests/GetProjectBaseUrl_test.py @@ -33,13 +33,24 @@ def json(): def raise_for_status(self): if self.throw: raise self.throw("oh no") - return def FakeLogger(): return +@pytest.fixture(name="readme_api_v1_success") +def fixture_readme_api_v1_success(monkeypatch): + monkeypatch.setattr(requests, "get", lambda *_, **__: MockResponse()) + + +@pytest.fixture(name="readme_api_v1_http_error") +def fixture_readme_api_v1_http_error(monkeypatch): + monkeypatch.setattr( + requests, "get", lambda *_, **__: MockResponse(throw=requests.HTTPError) + ) + + def test_get_project_base_url(readme_api_v1_success): assert get_project_base_url("", "secretkey", 3, FakeLogger) == "https://zombo.com" @@ -48,17 +59,5 @@ def test_get_project_base_url_exception(readme_api_v1_http_error): try: get_project_base_url("", "secretkey", 3, FakeLogger) assert False - except: # pylint: disable=bare-except - # Do nothing - - -@pytest.fixture -def readme_api_v1_success(monkeypatch): - monkeypatch.setattr(requests, "get", lambda *_, **__: MockResponse()) - - -@pytest.fixture -def readme_api_v1_http_error(monkeypatch): - monkeypatch.setattr( - requests, "get", lambda *_, **__: MockResponse(throw=requests.HTTPError) - ) + except Exception: + assert True