22
33import base64
44
5- import httpx
65import pytest
76
87
@@ -24,6 +23,7 @@ def test_public_repo(
2423 token_other ,
2524 gh_create_fork ,
2625 gh_other_username ,
26+ http_client ,
2727):
2828 # Create a GitHub repo, make it public
2929 gh_create_repo ("--public" )
@@ -60,14 +60,12 @@ def test_public_repo(
6060 # - coverage branch readme url
6161 assert len (links ) == 5
6262
63- client = httpx .Client ()
64-
6563 # Check that all 5 links are valid and lead to a 200
6664 # It's made this way to avoid hardcoding links in the test, because I assume
6765 # they'll be evolving.
6866 number_of_svgs = 0
6967 for link in links :
70- response = client .get (link )
68+ response = http_client .get (link )
7169 response .raise_for_status ()
7270 number_of_svgs += int (response .text .startswith ("<svg" ))
7371
@@ -81,7 +79,7 @@ def test_public_repo(
8179 raw_url_prefix = f"https://github.com/{ repo_full_name } /raw/python-coverage-comment-action-data-my-great-project"
8280
8381 readme_url = f"{ raw_url_prefix } /README.md"
84- response = client .get (readme_url , follow_redirects = True )
82+ response = http_client .get (readme_url , follow_redirects = True )
8583 response .raise_for_status ()
8684 # And all previously found links should be present
8785 readme = response .text
@@ -91,13 +89,13 @@ def test_public_repo(
9189 # And while we're at it, there are 2 other files we want to check in this
9290 # branch. Once again, trying to avoid hardcoding too many specifics, that's what
9391 # unit tests are for.
94- data = client .get (f"{ raw_url_prefix } /data.json" , follow_redirects = True ).json ()
92+ data = http_client .get (f"{ raw_url_prefix } /data.json" , follow_redirects = True ).json ()
9593 assert "coverage" in data
9694 assert "raw_data" in data
9795 assert "meta" in data ["raw_data" ]
9896 assert "coverage_path" in data
9997
100- endpoint = client .get (
98+ endpoint = http_client .get (
10199 f"{ raw_url_prefix } /endpoint.json" , follow_redirects = True
102100 ).json ()
103101 assert "schemaVersion" in endpoint
0 commit comments