Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#460)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.5 → v0.3.7](astral-sh/ruff-pre-commit@v0.3.5...v0.3.7)
- [github.com/psf/black: 24.3.0 → 24.4.0](psf/black@24.3.0...24.4.0)

* Switch to pytest style

* Disable broken test

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kiran Jonnalagadda <kiran@hasgeek.com>
  • Loading branch information
pre-commit-ci[bot] and jace committed Apr 15, 2024
1 parent e29ed12 commit 007776a
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
'--remove-duplicate-keys',
]
- 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']
Expand Down Expand Up @@ -51,7 +51,7 @@ repos:
additional_dependencies:
- tomli
- 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
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ disable = [
'too-few-public-methods',
'too-many-ancestors',
'too-many-arguments',
'too-many-function-args',
'too-many-instance-attributes',
'too-many-lines',
'too-many-locals',
Expand Down Expand Up @@ -283,3 +284,7 @@ section-order = [
'first-party',
'local-folder',
]

[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Config for tools that don't yet support pyproject.toml

[flake8]
ignore = I100, I201, E501, E124, E128, E124, E203, E402, E704, W503, N805, S101, D105, D107, D202, D205, D400, ANN002, ANN003, ANN101, ANN102, ANN401
ignore = I100, I201, E501, E124, E128, E124, E203, E402, E704, W503, N805, S101, D105, D107, D202, D205, D400, A005, ANN002, ANN003, ANN101, ANN102, ANN401
max-line-length = 88
exclude = build/lib
classmethod-decorators=classmethod, declared_attr, expression, comparator
Expand Down
6 changes: 3 additions & 3 deletions tests/coaster_tests/assets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# --- VersionedAssets tests ------------------------------------------------------------


@pytest.fixture()
@pytest.fixture
def assets() -> VersionedAssets:
"""Sample asset fixture."""
_assets = VersionedAssets()
Expand Down Expand Up @@ -127,13 +127,13 @@ def test_blacklist(assets: VersionedAssets) -> None:
# for the tests here


@pytest.fixture()
@pytest.fixture
def app1() -> Flask:
"""First Flask app fixture."""
return Flask(__name__)


@pytest.fixture()
@pytest.fixture
def app2() -> Flask:
"""Second Flask app fixture."""
return Flask(__name__)
Expand Down
8 changes: 4 additions & 4 deletions tests/coaster_tests/auth_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,21 @@ class Client(BaseMixin, Model):
# --- Fixtures -------------------------------------------------------------------------


@pytest.fixture()
@pytest.fixture
def login_manager(app: Flask) -> Iterator[LoginManager]:
"""Login manager fixture."""
yield LoginManager(app)
del app.login_manager # type: ignore[attr-defined]


@pytest.fixture()
@pytest.fixture
def flask_login_manager(app: Flask) -> Iterator[FlaskLoginManager]:
"""Flask-Login style login manager fixture."""
yield FlaskLoginManager(app)
del app.login_manager # type: ignore[attr-defined]


@pytest.fixture()
@pytest.fixture
def request_ctx(app: Flask) -> Iterator:
"""Request context with database models."""
ctx = app.test_request_context()
Expand Down Expand Up @@ -227,7 +227,7 @@ def test_current_auth_with_user_loaded(
assert current_auth.is_authenticated # type: ignore[unreachable]
assert current_auth
assert current_auth.user is not None
assert current_auth.user == user
assert current_auth.user == user # type: ignore[unreachable]
assert current_auth.actor == user


Expand Down
2 changes: 1 addition & 1 deletion tests/coaster_tests/sqlalchemy_models_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@ def test_uuid_default(self) -> None:
assert u4 is None

# UuidMixin works likewise
um1 = uuidm_no.uuid
um1 = uuidm_no.uuid # type: ignore[unreachable]
assert isinstance(um1, UUID)
um2 = uuidm_yes.uuid # This should generate uuidm_yes.id
assert isinstance(um2, UUID)
Expand Down
14 changes: 7 additions & 7 deletions tests/coaster_tests/sqlalchemy_registry_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# --- Fixtures -------------------------------------------------------------------------


@pytest.fixture()
@pytest.fixture
def CallableRegistry(): # noqa: N802
"""Callable registry with a positional parameter."""

Expand All @@ -25,7 +25,7 @@ class CallableRegistry:
return CallableRegistry


@pytest.fixture()
@pytest.fixture
def PropertyRegistry(): # noqa: N802
"""Registry with property and a positional parameter."""

Expand All @@ -35,7 +35,7 @@ class PropertyRegistry:
return PropertyRegistry


@pytest.fixture()
@pytest.fixture
def CachedPropertyRegistry(): # noqa: N802
"""Registry with cached property and a positional parameter."""

Expand All @@ -45,7 +45,7 @@ class CachedPropertyRegistry:
return CachedPropertyRegistry


@pytest.fixture()
@pytest.fixture
def CallableParamRegistry(): # noqa: N802
"""Callable registry with a keyword parameter."""

Expand All @@ -55,7 +55,7 @@ class CallableParamRegistry:
return CallableParamRegistry


@pytest.fixture()
@pytest.fixture
def PropertyParamRegistry(): # noqa: N802
"""Registry with property and a keyword parameter."""

Expand All @@ -65,7 +65,7 @@ class PropertyParamRegistry:
return PropertyParamRegistry


@pytest.fixture()
@pytest.fixture
def CachedPropertyParamRegistry(): # noqa: N802
"""Registry with cached property and a keyword parameter."""

Expand All @@ -75,7 +75,7 @@ class CachedPropertyParamRegistry:
return CachedPropertyParamRegistry


@pytest.fixture()
@pytest.fixture
def all_registry_hosts(
CallableRegistry, # noqa: N803
PropertyRegistry,
Expand Down
7 changes: 4 additions & 3 deletions tests/coaster_tests/utils_classes_dataclass_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ class MetadataEnum(StringMetadata, Enum):
del MetadataEnum.__format__


@pytest.fixture()
@pytest.fixture
def a() -> StringMetadata:
return StringMetadata('a', "A string")


@pytest.fixture()
@pytest.fixture
def b() -> StringMetadata:
return StringMetadata('b', "B string")


@pytest.fixture()
@pytest.fixture
def b2() -> StringMetadata:
return StringMetadata('b', "Also B string", "Extra metadata")

Expand Down Expand Up @@ -189,6 +189,7 @@ class WithoutRepr(DataclassFromType, str):
def test_metadata_enum() -> None:
"""Enum members behave like strings."""
assert isinstance(MetadataEnum.FIRST, str)
assert isinstance(MetadataEnum.FIRST, MetadataEnum)
assert MetadataEnum.FIRST.self == "first"
assert MetadataEnum.FIRST == "first"
assert MetadataEnum.SECOND == "second" # type: ignore[unreachable]
Expand Down
14 changes: 7 additions & 7 deletions tests/coaster_tests/views_loadmodels_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def setUp(self) -> None:
self.session.add(self.child2)
self.session.commit()

@pytest.mark.flaky()
@pytest.mark.flaky
def test_container(self) -> None:
assert self.app.login_manager is not None # type: ignore[attr-defined]
with self.app.test_request_context():
Expand All @@ -326,7 +326,7 @@ def test_named_document(self) -> None:
== self.nd2
)

@pytest.mark.flaky()
@pytest.mark.flaky
def test_redirect_document(self) -> None:
with self.app.test_request_context('/c/named-document'):
assert (
Expand Down Expand Up @@ -361,7 +361,7 @@ def test_scoped_named_document(self) -> None:
== self.snd2
)

@pytest.mark.flaky()
@pytest.mark.flaky
def test_id_named_document(self) -> None:
assert (
t_id_named_document(container='c', document='1-id-named-document')
Expand Down Expand Up @@ -390,7 +390,7 @@ def test_scoped_id_document(self) -> None:
assert t_scoped_id_document(container='c', document=1) == self.sid1
assert t_scoped_id_document(container='c', document=2) == self.sid2

@pytest.mark.flaky()
@pytest.mark.flaky
def test_scoped_id_named_document(self) -> None:
assert (
t_scoped_id_named_document(
Expand Down Expand Up @@ -447,7 +447,7 @@ def test_unmutated_inherited_permissions(self) -> None:
assert self.pc.permissions(user, inherited=inherited) == {'add-video', 'view'}
assert inherited == {'add-video'}

@pytest.mark.flaky()
@pytest.mark.flaky
def test_loadmodel_permissions(self) -> None:
with self.app.test_request_context():
self.app.login_manager.set_user_for_testing( # type: ignore[attr-defined]
Expand All @@ -458,7 +458,7 @@ def test_loadmodel_permissions(self) -> None:
with pytest.raises(Forbidden):
t_dotted_document_delete(document='parent', child=1)

@pytest.mark.flaky()
@pytest.mark.flaky
def test_load_user_to_g(self) -> None:
with self.app.test_request_context():
user = User(username='baz')
Expand All @@ -469,7 +469,7 @@ def test_load_user_to_g(self) -> None:
with pytest.raises(NotFound):
t_load_user_to_g(username='boo')

@pytest.mark.flaky()
@pytest.mark.flaky
def test_single_model_in_loadmodels(self) -> None:
with self.app.test_request_context():
user = User(username='user1')
Expand Down

0 comments on commit 007776a

Please sign in to comment.