1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-10 09:35:34 +00:00

Add isort to code lint

This commit is contained in:
Jair Henrique
2022-10-09 11:23:20 -03:00
parent eb59d871b4
commit 0eece7f96e
50 changed files with 147 additions and 111 deletions

View File

@@ -8,6 +8,7 @@ asyncio = pytest.importorskip("asyncio")
aiohttp = pytest.importorskip("aiohttp")
import vcr # noqa: E402
from .aiohttp_utils import aiohttp_app, aiohttp_request # noqa: E402

View File

@@ -2,11 +2,13 @@ import pytest
boto = pytest.importorskip("boto")
from configparser import DuplicateSectionError # NOQA
import boto # NOQA
import boto.iam # NOQA
from boto.s3.connection import S3Connection # NOQA
from boto.s3.key import Key # NOQA
from configparser import DuplicateSectionError # NOQA
import vcr # NOQA
@@ -15,6 +17,7 @@ def test_boto_stubs(tmpdir):
# Perform the imports within the patched context so that
# CertValidatingHTTPSConnection refers to the patched version.
from boto.https_connection import CertValidatingHTTPSConnection
from vcr.stubs.boto_stubs import VCRCertValidatingHTTPSConnection
# Prove that the class was patched by the stub and that we can instantiate it.

View File

@@ -1,10 +1,12 @@
import pytest
import os
import pytest
boto3 = pytest.importorskip("boto3")
import boto3 # NOQA
import botocore # NOQA
import vcr # NOQA
try:
@@ -64,6 +66,7 @@ def test_boto_vendored_stubs(tmpdir):
HTTPConnection,
VerifiedHTTPSConnection,
)
from vcr.stubs.boto3_stubs import VCRRequestsHTTPConnection, VCRRequestsHTTPSConnection
# Prove that the class was patched by the stub and that we can instantiate it.

View File

@@ -1,9 +1,11 @@
import os
import json
import pytest
import vcr
import os
from urllib.request import urlopen
import pytest
import vcr
def test_set_serializer_default_config(tmpdir, httpbin):
my_vcr = vcr.VCR(serializer="json")

View File

@@ -1,12 +1,14 @@
import base64
import pytest
from urllib.request import urlopen, Request
from urllib.parse import urlencode
from urllib.error import HTTPError
import vcr
import json
from urllib.error import HTTPError
from urllib.parse import urlencode
from urllib.request import Request, urlopen
import pytest
from assertions import assert_cassette_has_one_response, assert_is_json
import vcr
def _request_with_auth(url, username, password):
request = Request(url)

View File

@@ -2,15 +2,14 @@
"""Integration tests with httplib2"""
import sys
from urllib.parse import urlencode
import pytest
import pytest_httpbin.certs
from assertions import assert_cassette_has_one_response
import vcr
from assertions import assert_cassette_has_one_response
httplib2 = pytest.importorskip("httplib2")

View File

@@ -1,6 +1,7 @@
import pytest
import os
import pytest
asyncio = pytest.importorskip("asyncio")
httpx = pytest.importorskip("httpx")

View File

@@ -1,6 +1,7 @@
from urllib.request import urlopen
import socket
from contextlib import contextmanager
from urllib.request import urlopen
import vcr

View File

@@ -1,7 +1,8 @@
import vcr
import pytest
from urllib.request import urlopen
import pytest
import vcr
DEFAULT_URI = "http://httpbin.org/get?p1=q1&p2=q2" # base uri for testing

View File

@@ -1,7 +1,9 @@
import pytest
import vcr
from urllib.request import urlopen
import pytest
import vcr
def test_making_extra_request_raises_exception(tmpdir, httpbin):
# make two requests in the first request that are considered

View File

@@ -1,15 +1,13 @@
# -*- coding: utf-8 -*-
"""Test using a proxy."""
# External imports
import multiprocessing
import pytest
import http.server
import multiprocessing
import socketserver
from urllib.request import urlopen
# Internal imports
import pytest
import vcr
# Conditional imports

View File

@@ -1,7 +1,9 @@
import pytest
import vcr
from urllib.request import urlopen
import pytest
import vcr
def test_once_record_mode(tmpdir, httpbin):
testfile = str(tmpdir.join("recordmode.yml"))

View File

@@ -1,6 +1,7 @@
import vcr
from urllib.request import urlopen
import vcr
def true_matcher(r1, r2):
return True

View File

@@ -1,6 +1,7 @@
import vcr
from urllib.request import urlopen
import vcr
def test_recorded_request_uri_with_redirected_request(tmpdir, httpbin):
with vcr.use_cassette(str(tmpdir.join("test.yml"))) as cass:

View File

@@ -1,8 +1,9 @@
"""Test requests' interaction with vcr"""
import pytest
import vcr
from assertions import assert_cassette_empty, assert_is_json
import vcr
requests = pytest.importorskip("requests")
from requests.exceptions import ConnectionError # noqa E402

View File

@@ -1,10 +1,11 @@
import vcr
import zlib
import json
import http.client as httplib
import json
import zlib
from assertions import assert_is_json
import vcr
def _headers_are_case_insensitive(host, port):
conn = httplib.HTTPConnection(host, port)

View File

@@ -4,11 +4,11 @@
import json
import pytest
from assertions import assert_cassette_empty, assert_is_json
import vcr
from vcr.errors import CannotOverwriteExistingCassetteException
from assertions import assert_cassette_empty, assert_is_json
tornado = pytest.importorskip("tornado")
http = pytest.importorskip("tornado.httpclient")

View File

@@ -2,15 +2,15 @@
"""Integration tests with urllib2"""
import ssl
from urllib.request import urlopen
from urllib.parse import urlencode
from urllib.request import urlopen
import pytest_httpbin.certs
from assertions import assert_cassette_has_one_response
# Internal imports
import vcr
from assertions import assert_cassette_has_one_response
def urlopen_with_cafile(*args, **kwargs):
context = ssl.create_default_context(cafile=pytest_httpbin.certs.where())

View File

@@ -4,9 +4,10 @@
import pytest
import pytest_httpbin
from assertions import assert_cassette_empty, assert_is_json
import vcr
from vcr.patch import force_reset
from assertions import assert_cassette_empty, assert_is_json
urllib3 = pytest.importorskip("urllib3")

View File

@@ -1,9 +1,10 @@
import http.client as httplib
import multiprocessing
import pytest
from xmlrpc.client import ServerProxy
from xmlrpc.server import SimpleXMLRPCServer
import pytest
requests = pytest.importorskip("requests")
import vcr # NOQA