From f091e329438196068f3ff5c8cac955940e81efd1 Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Tue, 21 Dec 2021 16:18:43 -0500 Subject: [PATCH 1/2] test: replace pytest-flake8 with pre-commit There's weird behaviors with Flake8 interacting with pytest. Instead of using pytest to run the tests, make it a pre-commit hook. Resolves #82 Signed-off-by: Mike Fiedler --- .pre-commit-config.yaml | 17 +++++++++++++++++ pyproject.toml | 1 - pytest.ini | 1 - 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..e5fc3af --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: check-yaml + - id: check-added-large-files +- repo: https://github.com/editorconfig-checker/editorconfig-checker.python + rev: '2.4.0' + hooks: + - id: editorconfig-checker + alias: ec +- repo: https://github.com/pycqa/flake8 + rev: '4.0.1' + hooks: + - id: flake8 diff --git a/pyproject.toml b/pyproject.toml index 31e1bbc..840df06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,6 @@ pytest = ">=3.6.3" pytest = "^6.0" pytest-cov = "^2.8.1" pytest-httpbin = "^1.0" -pytest-flake8 = "^1.0.4" asynctest = "^0.13.0" requests = "^2.26.0" starlette = "^0.14.2" diff --git a/pytest.ini b/pytest.ini index 05b6086..77135b7 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,4 +2,3 @@ addopts = --cov --cov-report=term - --flake8 From c54ebb4f493c8907325cefe539fb9b298ba9696e Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Tue, 21 Dec 2021 16:23:20 -0500 Subject: [PATCH 2/2] docs: add badge to readme Signed-off-by: Mike Fiedler --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 663d34c..1c28a9d 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![PyPI current version](https://img.shields.io/pypi/v/pytest-socket.svg)](https://pypi.python.org/pypi/pytest-socket) [![Python Support](https://img.shields.io/pypi/pyversions/pytest-socket.svg)](https://pypi.python.org/pypi/pytest-socket) [![Tests](https://github.com/miketheman/pytest-socket/workflows/Python%20Tests/badge.svg)](https://github.com/miketheman/pytest-socket/actions?query=workflow%3A%22Python+Tests%22) +[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/miketheman/pytest-socket/main.svg)](https://results.pre-commit.ci/latest/github/miketheman/pytest-socket/main) [![Maintainability](https://api.codeclimate.com/v1/badges/1608a75b1c3a20211992/maintainability)](https://codeclimate.com/github/miketheman/pytest-socket/maintainability) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmiketheman%2Fpytest-socket.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmiketheman%2Fpytest-socket?ref=badge_shield)