[go: nahoru, domu]

Skip to content

Commit

Permalink
test: add vulture to detect dead code
Browse files Browse the repository at this point in the history
Part of the pre-commit stack, so we prevent it from sneaking in.

Signe-off-by: Mike Fiedler <miketheman@gmail.com>
  • Loading branch information
miketheman committed Jul 18, 2022
1 parent 2186e26 commit 7ba12ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ repos:
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/jendrikseipp/vulture
rev: 'v2.5'
hooks:
- id: vulture
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ known_first_party = ['pytest_socket', 'conftest', 'test_socket']
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#profilegcm
profile = "black"

[tool.vulture]
ignore_decorators = ["@pytest.fixture"]
ignore_names = ["pytest_*"]
paths = ["pytest_socket.py"]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
4 changes: 2 additions & 2 deletions pytest_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@


class SocketBlockedError(RuntimeError):
def __init__(self, *args, **kwargs):
def __init__(self, *_args, **_kwargs):
super().__init__("A test tried to use socket.socket.")


class SocketConnectBlockedError(RuntimeError):
def __init__(self, allowed, host, *args, **kwargs):
def __init__(self, allowed, host, *_args, **_kwargs):
if allowed:
allowed = ",".join(allowed)
super().__init__(
Expand Down

0 comments on commit 7ba12ac

Please sign in to comment.