Skip to content

Commit

Permalink
Enable E, W and F linters for ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
jairhenrique committed Jun 26, 2023
1 parent c18d683 commit f4e1d55
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 27 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ markers = [
select = [
"C4", # flake8-comprehensions
"COM", # flake8-commas
"E", # pycodestyle error
"F", # pyflakes
"I", # isort
"ISC", # flake8-implicit-str-concat
"PIE", # flake8-pie
"RUF", # Ruff-specific rules
"UP", # pyupgrade
"W", # pycodestyle warning
]
line-length = 110
target-version = "py38"
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/test_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

import pytest

import vcr

asyncio = pytest.importorskip("asyncio")
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):
Expand Down
16 changes: 8 additions & 8 deletions tests/integration/test_boto.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import pytest

boto = pytest.importorskip("boto")

from configparser import DuplicateSectionError

import boto
import boto.iam
from boto.s3.connection import S3Connection
from boto.s3.key import Key
import pytest

import vcr

boto = pytest.importorskip("boto")

import boto # noqa
import boto.iam # noqa
from boto.s3.connection import S3Connection # noqa
from boto.s3.key import Key # noqa


def test_boto_stubs(tmpdir):
with vcr.use_cassette(str(tmpdir.join("boto-stubs.yml"))):
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/test_boto3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import pytest

boto3 = pytest.importorskip("boto3")
import vcr

import boto3
import botocore
boto3 = pytest.importorskip("boto3")

import vcr
import boto3 # noqa
import botocore # noqa

try:
from botocore import awsrequest
from botocore import awsrequest # noqa

botocore_awsrequest = True
except ImportError:
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/test_httpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import pytest

import vcr

asyncio = pytest.importorskip("asyncio")
httpx = pytest.importorskip("httpx")

import vcr
from vcr.stubs.httpx_stubs import HTTPX_REDIRECT_PARAM

from vcr.stubs.httpx_stubs import HTTPX_REDIRECT_PARAM # noqa: E402


class BaseDoRequest:
Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import vcr

requests = pytest.importorskip("requests")
from requests.exceptions import ConnectionError # E402


def test_status_code(httpbin_both, tmpdir):
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_wild.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

import pytest

requests = pytest.importorskip("requests")

import vcr

requests = pytest.importorskip("requests")


def test_domain_redirect():
"""Ensure that redirects across domains are considered unique"""
Expand Down
6 changes: 1 addition & 5 deletions tests/unit/test_vcr_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ def test_vcr_import_deprecation(recwarn):
# Remove imported module entry if already loaded in another test
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
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ skipsdist = True
commands =
black --version
black --check --diff .
ruff --version
ruff check .
deps =
black
Expand Down
2 changes: 1 addition & 1 deletion vcr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from logging import NullHandler

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

__version__ = "5.0.0"

Expand Down
2 changes: 1 addition & 1 deletion vcr/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from botocore.awsrequest import AWSHTTPConnection, AWSHTTPSConnection
except ImportError as e:
try:
import botocore.vendored.requests
import botocore.vendored.requests # noqa: F401
except ImportError: # pragma: no cover
pass
else:
Expand Down

0 comments on commit f4e1d55

Please sign in to comment.