mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
Enable E, W and F linters for ruff
This commit is contained in:
@@ -1,13 +1,6 @@
|
|||||||
[tool.black]
|
[tool.black]
|
||||||
line-length=110
|
line-length=110
|
||||||
|
|
||||||
[tool.isort]
|
|
||||||
line_length = 110
|
|
||||||
known_first_party = "vcrpy"
|
|
||||||
multi_line_output = 3
|
|
||||||
use_parentheses = true
|
|
||||||
include_trailing_comma = true
|
|
||||||
|
|
||||||
[tool.codespell]
|
[tool.codespell]
|
||||||
skip = '.git,*.pdf,*.svg,.tox'
|
skip = '.git,*.pdf,*.svg,.tox'
|
||||||
ignore-regex = "\\\\[fnrstv]"
|
ignore-regex = "\\\\[fnrstv]"
|
||||||
@@ -23,11 +16,14 @@ markers = [
|
|||||||
select = [
|
select = [
|
||||||
"C4", # flake8-comprehensions
|
"C4", # flake8-comprehensions
|
||||||
"COM", # flake8-commas
|
"COM", # flake8-commas
|
||||||
|
"E", # pycodestyle error
|
||||||
|
"F", # pyflakes
|
||||||
"I", # isort
|
"I", # isort
|
||||||
"ISC", # flake8-implicit-str-concat
|
"ISC", # flake8-implicit-str-concat
|
||||||
"PIE", # flake8-pie
|
"PIE", # flake8-pie
|
||||||
"RUF", # Ruff-specific rules
|
"RUF", # Ruff-specific rules
|
||||||
"UP", # pyupgrade
|
"UP", # pyupgrade
|
||||||
|
"W", # pycodestyle warning
|
||||||
]
|
]
|
||||||
line-length = 110
|
line-length = 110
|
||||||
target-version = "py38"
|
target-version = "py38"
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ import urllib.parse
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
import vcr
|
||||||
|
|
||||||
asyncio = pytest.importorskip("asyncio")
|
asyncio = pytest.importorskip("asyncio")
|
||||||
aiohttp = pytest.importorskip("aiohttp")
|
aiohttp = pytest.importorskip("aiohttp")
|
||||||
|
|
||||||
import vcr
|
|
||||||
|
|
||||||
from .aiohttp_utils import aiohttp_app, aiohttp_request
|
from .aiohttp_utils import aiohttp_app, aiohttp_request # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
def run_in_loop(fn):
|
def run_in_loop(fn):
|
||||||
@@ -59,7 +60,7 @@ def test_headers(tmpdir, auth, mockbin_request_url):
|
|||||||
request = cassette.requests[0]
|
request = cassette.requests[0]
|
||||||
assert "AUTHORIZATION" in request.headers
|
assert "AUTHORIZATION" in request.headers
|
||||||
cassette_response, _ = get(url, auth=auth)
|
cassette_response, _ = get(url, auth=auth)
|
||||||
assert dict(cassette_response.headers) == dict(response.headers)
|
assert cassette_response.headers.items() == response.headers.items()
|
||||||
assert cassette.play_count == 1
|
assert cassette.play_count == 1
|
||||||
assert "istr" not in cassette.data[0]
|
assert "istr" not in cassette.data[0]
|
||||||
assert "yarl.URL" not in cassette.data[0]
|
assert "yarl.URL" not in cassette.data[0]
|
||||||
@@ -278,7 +279,7 @@ def test_redirect(tmpdir, mockbin):
|
|||||||
# looking request_info.
|
# looking request_info.
|
||||||
assert cassette_response.request_info.url == response.request_info.url
|
assert cassette_response.request_info.url == response.request_info.url
|
||||||
assert cassette_response.request_info.method == response.request_info.method
|
assert cassette_response.request_info.method == response.request_info.method
|
||||||
assert dict(cassette_response.request_info.headers.items()) == dict(response.request_info.headers.items())
|
assert cassette_response.request_info.headers.items() == response.request_info.headers.items()
|
||||||
assert cassette_response.request_info.real_url == response.request_info.real_url
|
assert cassette_response.request_info.real_url == response.request_info.real_url
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
|
from configparser import DuplicateSectionError
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
import vcr
|
||||||
|
|
||||||
boto = pytest.importorskip("boto")
|
boto = pytest.importorskip("boto")
|
||||||
|
|
||||||
from configparser import DuplicateSectionError
|
import boto # noqa
|
||||||
|
import boto.iam # noqa
|
||||||
import boto
|
from boto.s3.connection import S3Connection # noqa
|
||||||
import boto.iam
|
from boto.s3.key import Key # noqa
|
||||||
from boto.s3.connection import S3Connection
|
|
||||||
from boto.s3.key import Key
|
|
||||||
|
|
||||||
import vcr
|
|
||||||
|
|
||||||
|
|
||||||
def test_boto_stubs(tmpdir):
|
def test_boto_stubs(tmpdir):
|
||||||
|
|||||||
@@ -2,15 +2,14 @@ import os
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
boto3 = pytest.importorskip("boto3")
|
|
||||||
|
|
||||||
import boto3
|
|
||||||
import botocore
|
|
||||||
|
|
||||||
import vcr
|
import vcr
|
||||||
|
|
||||||
|
boto3 = pytest.importorskip("boto3")
|
||||||
|
|
||||||
|
import botocore # noqa
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from botocore import awsrequest
|
from botocore import awsrequest # noqa
|
||||||
|
|
||||||
botocore_awsrequest = True
|
botocore_awsrequest = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ import os
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
import vcr
|
||||||
|
|
||||||
asyncio = pytest.importorskip("asyncio")
|
asyncio = pytest.importorskip("asyncio")
|
||||||
httpx = pytest.importorskip("httpx")
|
httpx = pytest.importorskip("httpx")
|
||||||
|
|
||||||
import vcr
|
from vcr.stubs.httpx_stubs import HTTPX_REDIRECT_PARAM # noqa: E402
|
||||||
from vcr.stubs.httpx_stubs import HTTPX_REDIRECT_PARAM
|
|
||||||
|
|
||||||
|
|
||||||
class BaseDoRequest:
|
class BaseDoRequest:
|
||||||
@@ -185,7 +186,7 @@ def test_redirect(mockbin, yml, do_request):
|
|||||||
# looking request_info.
|
# looking request_info.
|
||||||
assert cassette_response.request.url == response.request.url
|
assert cassette_response.request.url == response.request.url
|
||||||
assert cassette_response.request.method == response.request.method
|
assert cassette_response.request.method == response.request.method
|
||||||
assert dict(cassette_response.request.headers.items()) == dict(response.request.headers.items())
|
assert cassette_response.request.headers.items() == response.request.headers.items()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.online
|
@pytest.mark.online
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from assertions import assert_cassette_empty, assert_is_json_bytes
|
|||||||
import vcr
|
import vcr
|
||||||
|
|
||||||
requests = pytest.importorskip("requests")
|
requests = pytest.importorskip("requests")
|
||||||
from requests.exceptions import ConnectionError # E402
|
|
||||||
|
|
||||||
|
|
||||||
def test_status_code(httpbin_both, tmpdir):
|
def test_status_code(httpbin_both, tmpdir):
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ from xmlrpc.server import SimpleXMLRPCServer
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
requests = pytest.importorskip("requests")
|
|
||||||
|
|
||||||
import vcr
|
import vcr
|
||||||
|
|
||||||
|
requests = pytest.importorskip("requests")
|
||||||
|
|
||||||
|
|
||||||
def test_domain_redirect():
|
def test_domain_redirect():
|
||||||
"""Ensure that redirects across domains are considered unique"""
|
"""Ensure that redirects across domains are considered unique"""
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ def test_vcr_import_deprecation(recwarn):
|
|||||||
# Remove imported module entry if already loaded in another test
|
# Remove imported module entry if already loaded in another test
|
||||||
del sys.modules["vcr"]
|
del sys.modules["vcr"]
|
||||||
|
|
||||||
import vcr
|
import vcr # noqa: F401
|
||||||
|
|
||||||
if sys.version_info[0] == 2:
|
|
||||||
assert len(recwarn) == 1
|
|
||||||
assert issubclass(recwarn[0].category, DeprecationWarning)
|
|
||||||
else:
|
|
||||||
assert len(recwarn) == 0
|
assert len(recwarn) == 0
|
||||||
|
|||||||
4
tox.ini
4
tox.ini
@@ -37,6 +37,7 @@ skipsdist = True
|
|||||||
commands =
|
commands =
|
||||||
black --version
|
black --version
|
||||||
black --check --diff .
|
black --check --diff .
|
||||||
|
ruff --version
|
||||||
ruff check .
|
ruff check .
|
||||||
deps =
|
deps =
|
||||||
black
|
black
|
||||||
@@ -100,6 +101,3 @@ passenv =
|
|||||||
AWS_ACCESS_KEY_ID
|
AWS_ACCESS_KEY_ID
|
||||||
AWS_DEFAULT_REGION
|
AWS_DEFAULT_REGION
|
||||||
AWS_SECRET_ACCESS_KEY
|
AWS_SECRET_ACCESS_KEY
|
||||||
|
|
||||||
[flake8]
|
|
||||||
max_line_length = 110
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import logging
|
|||||||
from logging import NullHandler
|
from logging import NullHandler
|
||||||
|
|
||||||
from .config import VCR
|
from .config import VCR
|
||||||
from .record_mode import RecordMode as mode # import is not used in this file
|
from .record_mode import RecordMode as mode # noqa: F401
|
||||||
|
|
||||||
__version__ = "5.0.0"
|
__version__ = "5.0.0"
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ try:
|
|||||||
from botocore.awsrequest import AWSHTTPConnection, AWSHTTPSConnection
|
from botocore.awsrequest import AWSHTTPConnection, AWSHTTPSConnection
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
try:
|
try:
|
||||||
import botocore.vendored.requests
|
import botocore.vendored.requests # noqa: F401
|
||||||
except ImportError: # pragma: no cover
|
except ImportError: # pragma: no cover
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user