Skip to content

Commit

Permalink
Fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
2m authored and kevin1024 committed Jul 24, 2020
1 parent 133423c commit 0ef4001
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
12 changes: 5 additions & 7 deletions tests/integration/test_httpx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from unittest.mock import MagicMock
import pytest
import contextlib
import os
Expand Down Expand Up @@ -194,6 +193,7 @@ def test_behind_proxy(do_request):
def test_cookies(tmpdir, scheme, do_request):
def client_cookies(client):
return [c for c in client._client.cookies]

def response_cookies(response):
return [c for c in response.cookies]

Expand All @@ -204,25 +204,24 @@ def response_cookies(response):
testfile = str(tmpdir.join("cookies.yml"))
with vcr.use_cassette(testfile):
r1 = client("GET", url + "/cookies/set?k1=v1&k2=v2")
assert response_cookies(r1.history[0]) == ['k1', 'k2']
assert response_cookies(r1.history[0]) == ["k1", "k2"]
assert response_cookies(r1) == []

r2 = client("GET", url + "/cookies")
assert len(r2.json()["cookies"]) == 2

assert client_cookies(client) == ['k1', 'k2']

assert client_cookies(client) == ["k1", "k2"]

new_client = do_request()
assert client_cookies(new_client) == []

with vcr.use_cassette(testfile) as cassette:
cassette_response = new_client("GET", url + "/cookies/set?k1=v1&k2=v2")
assert response_cookies(cassette_response.history[0]) == ['k1', 'k2']
assert response_cookies(cassette_response.history[0]) == ["k1", "k2"]
assert response_cookies(cassette_response) == []

assert cassette.play_count == 2
assert client_cookies(new_client) == ['k1', 'k2']
assert client_cookies(new_client) == ["k1", "k2"]


def test_relative_redirects(tmpdir, scheme, do_request):
Expand All @@ -239,4 +238,3 @@ def test_relative_redirects(tmpdir, scheme, do_request):
assert response.json()["url"].endswith("get")

assert cassette.play_count == 3

8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
skip_missing_interpreters=true
envlist =
envlist =
cov-clean,
lint,
{py35,py36,py37,py38}-{requests,httplib2,urllib3,tornado4,boto3,aiohttp,httpx},
Expand All @@ -18,7 +18,7 @@ commands = coverage erase
[testenv:cov-report]
deps = coverage
skip_install=true
commands =
commands =
coverage html
coverage report --fail-under=90

Expand All @@ -30,8 +30,8 @@ commands =
flake8 --version
flake8 --exclude=./docs/conf.py,./.tox/
pyflakes ./docs/conf.py
deps =
flake8
deps =
flake8
black

[testenv:docs]
Expand Down
1 change: 0 additions & 1 deletion vcr/stubs/httpx_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import logging
from unittest.mock import patch, MagicMock

from yarl import URL
import httpx
from vcr.request import Request as VcrRequest
from vcr.errors import CannotOverwriteExistingCassetteException
Expand Down

0 comments on commit 0ef4001

Please sign in to comment.