Skip to content

Commit

Permalink
Pytest plugin updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
coady committed Feb 22, 2024
1 parent 7fef70f commit 3d94270
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ quote-style = "preserve"
module = ["httpx.*"]
ignore_missing_imports = true

[tool.pytest.ini_options]
asyncio_mode = "auto"

[tool.coverage.run]
source = ["clients"]
branch = true
5 changes: 2 additions & 3 deletions tests/requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
httpx>=0.25
pytest-cov
werkzeug<3 # psf/httpbin#28,35,36
pytest-httpbin
pytest-asyncio
pytest-httpbin>=0.10.2
pytest-asyncio>=0.17
6 changes: 0 additions & 6 deletions tests/test_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import clients


@pytest.mark.asyncio
async def test_client(url):
client = clients.AsyncClient(url, params={'q': 0})
coros = (
Expand All @@ -24,7 +23,6 @@ async def test_client(url):
assert set(r.json()) == {'origin'} and r.url.query == b'q=1'


@pytest.mark.asyncio
async def test_resource(url):
params = {'etag': 'W/0', 'last-modified': 'now'}
resource = clients.AsyncResource(url, params=params)
Expand All @@ -40,7 +38,6 @@ async def test_resource(url):
assert data['etag'] == 'W/0'


@pytest.mark.asyncio
async def test_content(url):
resource = clients.AsyncResource(url)
resource.content_type = lambda response: 'json'
Expand All @@ -60,15 +57,13 @@ def test_authorize(url, monkeypatch):
assert resource.headers['authorization'] == 'Bearer abc123'


@pytest.mark.asyncio
async def test_remote(url):
remote = clients.AsyncRemote(url, json={'key': 'value'})
assert (await remote('post'))['json'] == {'key': 'value'}
clients.AsyncRemote.check = operator.methodcaller('pop', 'json')
assert await (remote / 'post')(name='value') == {'key': 'value', 'name': 'value'}


@pytest.mark.asyncio
async def test_graph(url):
graph = clients.AsyncGraph(url).anything
data = await graph.execute('{ viewer { login }}')
Expand All @@ -77,7 +72,6 @@ async def test_graph(url):
clients.AsyncGraph.check({'errors': ['reason']})


@pytest.mark.asyncio
async def test_proxy(httpbin):
proxy = clients.AsyncProxy(httpbin.url, f'http://localhost:{httpbin.port}')
urls = {(await proxy.get('status/500')).url for _ in proxy.urls}
Expand Down

0 comments on commit 3d94270

Please sign in to comment.