From 432566628d2740f0f4349603a27d24af230b1be5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 23:35:44 +0530 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#480) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.3.5 → v0.3.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.5...v0.3.7) - [github.com/psf/black: 24.3.0 → 24.4.0](https://github.com/psf/black/compare/24.3.0...24.4.0) * Switch to pytest style * Ignore broken test --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Kiran Jonnalagadda --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 4 ++++ setup.cfg | 3 +-- src/baseframe/__init__.py | 2 -- tests/baseframe_tests/conftest.py | 6 +++--- tests/baseframe_tests/forms/fields_test.py | 4 ++-- tests/baseframe_tests/forms/form_test.py | 2 +- tests/baseframe_tests/forms/sqlalchemy_test.py | 6 +++--- tests/baseframe_tests/forms/validators_test.py | 2 +- tests/baseframe_tests/statsd_test.py | 8 ++++---- tests/baseframe_tests/utils_test.py | 2 +- 11 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 800dd0f9..6f36e24d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: hooks: - id: check-pre-commit-ci-config - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.5 + rev: v0.3.7 hooks: - id: ruff args: ['--fix', '--exit-non-zero-on-fix'] @@ -58,7 +58,7 @@ repos: additional_dependencies: - toml - repo: https://github.com/psf/black - rev: 24.3.0 + rev: 24.4.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-mypy diff --git a/pyproject.toml b/pyproject.toml index 1dd69b45..1bcfd420 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -286,3 +286,7 @@ section-order = [ [tool.ruff.lint.isort.sections] repo = ['baseframe'] + +[tool.ruff.lint.flake8-pytest-style] +fixture-parentheses = false +mark-parentheses = false diff --git a/setup.cfg b/setup.cfg index 30342d5b..f01e3db0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,13 +1,12 @@ # Config for tools that don't yet support pyproject.toml [flake8] -ignore = I100, I201, E501, E124, E128, E402, E704, W503, D100, D101, D102, D103, D104, D107, S101 +ignore = I100, I201, E501, E124, E128, E402, E704, W503, D100, D101, D102, D103, D104, D107, S101, A005 max-line-length = 88 exclude = src/baseframe/static enable-extensions = G accept-encodings = utf-8 classmethod-decorators=classmethod, declared_attr -pytest-fixture-no-parentheses = false [pycodestyle] max-line-length = 88 diff --git a/src/baseframe/__init__.py b/src/baseframe/__init__.py index 2c00d990..67e6155b 100644 --- a/src/baseframe/__init__.py +++ b/src/baseframe/__init__.py @@ -54,8 +54,6 @@ 'errors', 'extensions', 'filters', - 'filters', - 'forms', 'forms', 'localize_timezone', 'localized_country_list', diff --git a/tests/baseframe_tests/conftest.py b/tests/baseframe_tests/conftest.py index 8ec589e6..46a692e2 100644 --- a/tests/baseframe_tests/conftest.py +++ b/tests/baseframe_tests/conftest.py @@ -8,7 +8,7 @@ from baseframe import baseframe -@pytest.fixture() +@pytest.fixture def app(): """App fixture.""" fixture_app = Flask(__name__) @@ -18,13 +18,13 @@ def app(): return fixture_app -@pytest.fixture() +@pytest.fixture def ctx(app): with app.app_context() as context: yield context -@pytest.fixture() +@pytest.fixture def client(app): """App client fixture.""" with app.test_client() as test_client: diff --git a/tests/baseframe_tests/forms/fields_test.py b/tests/baseframe_tests/forms/fields_test.py index c08a380a..8d9ef06b 100644 --- a/tests/baseframe_tests/forms/fields_test.py +++ b/tests/baseframe_tests/forms/fields_test.py @@ -47,7 +47,7 @@ class DateTimeForm(forms.Form): # --- Tests ---------------------------------------------------------------------------- -@pytest.fixture() +@pytest.fixture def enum_form(ctx): """Enum form fixture.""" return EnumForm(meta={'csrf': False}) @@ -88,7 +88,7 @@ def test_enum_render(enum_form) -> None: ) -@pytest.fixture() +@pytest.fixture def json_form(ctx): """JSON form fixture.""" return JsonForm(meta={'csrf': False}) diff --git a/tests/baseframe_tests/forms/form_test.py b/tests/baseframe_tests/forms/form_test.py index b51e8665..96ca6fea 100644 --- a/tests/baseframe_tests/forms/form_test.py +++ b/tests/baseframe_tests/forms/form_test.py @@ -79,7 +79,7 @@ class FieldRenderForm(forms.Form): string_field = forms.StringField("String") -@pytest.fixture() +@pytest.fixture def user() -> SimpleUser: return SimpleUser( # nosec fullname="Test user", company="Test company", password="test" diff --git a/tests/baseframe_tests/forms/sqlalchemy_test.py b/tests/baseframe_tests/forms/sqlalchemy_test.py index 97cd9754..4130d2ec 100644 --- a/tests/baseframe_tests/forms/sqlalchemy_test.py +++ b/tests/baseframe_tests/forms/sqlalchemy_test.py @@ -39,7 +39,7 @@ class DocumentForm(forms.Form): content = forms.TextAreaField("Content") -@pytest.fixture() +@pytest.fixture def database(app): """Database structure.""" app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://' @@ -52,7 +52,7 @@ def database(app): db.drop_all() -@pytest.fixture() +@pytest.fixture def db_session(database): """Database session fixture.""" savepoint = database.session.begin_nested() @@ -61,7 +61,7 @@ def db_session(database): database.session.rollback() -@pytest.fixture() +@pytest.fixture def form(ctx): return DocumentForm(model=Document, meta={'csrf': False}) diff --git a/tests/baseframe_tests/forms/validators_test.py b/tests/baseframe_tests/forms/validators_test.py index 709b91cd..1c3e8f7a 100644 --- a/tests/baseframe_tests/forms/validators_test.py +++ b/tests/baseframe_tests/forms/validators_test.py @@ -62,7 +62,7 @@ class PublicEmailDomainFormTest(forms.Form): ) -@pytest.fixture() +@pytest.fixture def tforms(ctx): urllib3.disable_warnings() yield SimpleNamespace( diff --git a/tests/baseframe_tests/statsd_test.py b/tests/baseframe_tests/statsd_test.py index a87b25e1..04886a9e 100644 --- a/tests/baseframe_tests/statsd_test.py +++ b/tests/baseframe_tests/statsd_test.py @@ -17,20 +17,20 @@ from baseframe.statsd import Statsd -@pytest.fixture() +@pytest.fixture def app(): """Redefine app without Baseframe for statsd tests.""" return Flask(__name__) -@pytest.fixture() +@pytest.fixture def statsd(app): s = Statsd() s.init_app(app) return s -@pytest.fixture() +@pytest.fixture def view(app): @app.route('/') def index(): @@ -39,7 +39,7 @@ def index(): return index -@pytest.fixture() +@pytest.fixture def form(app): Babel(app) # Needed for form validator message translations diff --git a/tests/baseframe_tests/utils_test.py b/tests/baseframe_tests/utils_test.py index 1e0e933d..252bb994 100644 --- a/tests/baseframe_tests/utils_test.py +++ b/tests/baseframe_tests/utils_test.py @@ -14,7 +14,7 @@ # --- Fixtures ------------------------------------------------------------------------- -@pytest.fixture() +@pytest.fixture def testview(app): """Add a view to the app for testing."""