Skip to content

Commit

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

updates:
- [github.com/asottile/pyupgrade: v3.15.2 → v3.16.0](asottile/pyupgrade@v3.15.2...v3.16.0)
- https://github.com/charliermarsh/ruff-pre-commithttps://github.com/astral-sh/ruff-pre-commit
- [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.5.0](astral-sh/ruff-pre-commit@v0.4.7...v0.5.0)
- [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.10.1](pre-commit/mirrors-mypy@v1.10.0...v1.10.1)

* Avoid checking exact amount of warnings

It is not necessary for the intentions of the tests. Instead we're
checking a minimum expected amount is present.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Casper Welzel Andersen <43357585+CasperWA@users.noreply.github.com>
Co-authored-by: Casper Welzel Andersen <casper.w.andersen@sintef.no>
  • Loading branch information
3 people committed Jul 2, 2024
1 parent 2fa6da4 commit b3bbd5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ repos:
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
rev: v3.16.0
hooks:
- id: pyupgrade
args: ["--py39-plus"]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.4.7'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.5.0'

hooks:
- id: ruff
Expand All @@ -59,7 +59,7 @@ repos:
description: Update the API Reference documentation whenever a Python file is touched in the code base.

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.10.1
hooks:
- id: mypy
name: "MyPy"
Expand Down
8 changes: 6 additions & 2 deletions tests/server/middleware/test_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def test_showwarning_overload(
# Make sure a "normal" warning is treated as usual
warnings.warn(warning_message, UserWarning)
assert len(add_warning_middleware._warnings) == 1
assert len(recwarn.list) == 2, ", ".join(str(_) for _ in recwarn.list)
assert (
len(recwarn.list) >= 2
) # Ensure at least two warnings were raised (the ones we just added)
assert recwarn.pop(OptimadeWarning)
assert recwarn.pop(UserWarning)

Expand Down Expand Up @@ -68,7 +70,9 @@ def test_showwarning_debug(both_clients, recwarn):
assert "meta" in warning
for meta_field in ("filename", "lineno", "line"):
assert meta_field in warning["meta"]
assert len(recwarn.list) == 1, "\n\n".join(str(_) for _ in recwarn.list)
assert (
len(recwarn.list) >= 1
) # Ensure at least one warning was raised (the one we just added)
assert recwarn.pop(OptimadeWarning)
finally:
CONFIG.debug = org_debug
Expand Down

0 comments on commit b3bbd5c

Please sign in to comment.