Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.3
rev: v0.14.4
hooks:
- id: ruff-check
args: [--fix]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.9.0
rev: 25.11.0
hooks:
- id: black
args: [--preview]
Expand All @@ -26,7 +26,7 @@ repos:
- id: autoflake

- repo: https://github.com/asottile/pyupgrade
rev: v3.21.0
rev: v3.21.1
hooks:
- id: pyupgrade
args: [--py310-plus]
Expand Down
36 changes: 12 additions & 24 deletions tests/test_config_and_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,11 @@ def test_200_options(capsys: pytest.CaptureFixture[str]):

@pytest.mark.skipif(flake8 is None, reason="flake8 is not installed")
def test_anyio_from_config(tmp_path: Path, capsys: pytest.CaptureFixture[str]):
assert tmp_path.joinpath(".flake8").write_text(
"""
assert tmp_path.joinpath(".flake8").write_text("""
[flake8]
anyio = True
select = ASYNC220
"""
)
""")

from flake8_async.visitors.visitor2xx import Visitor22X # noqa: PLC0415

Expand Down Expand Up @@ -210,24 +208,20 @@ def test_anyio_from_config(tmp_path: Path, capsys: pytest.CaptureFixture[str]):

# `code` parameter temporarily introduced to test deprecation of trio200-blocking-calls
def _test_async200_from_config_common(tmp_path: Path, code: str = "async200") -> str:
assert tmp_path.joinpath(".flake8").write_text(
f"""
assert tmp_path.joinpath(".flake8").write_text(f"""
[flake8]
{code}-blocking-calls =
other -> async,
sync_fns.* -> the_async_equivalent,
select = ASYNC200
extend-ignore = E
"""
)
assert tmp_path.joinpath("example.py").write_text(
"""
""")
assert tmp_path.joinpath("example.py").write_text("""
import sync_fns

async def foo():
sync_fns.takes_a_long_time()
"""
)
""")
return (
"./example.py:5:5: ASYNC200 User-configured blocking sync call sync_fns.* "
"in async function, consider replacing with the_async_equivalent.\n"
Expand Down Expand Up @@ -506,13 +500,11 @@ def test_disable_noqa_ast(
@pytest.mark.skipif(flake8 is None, reason="flake8 is not installed")
def test_config_select_error_code(tmp_path: Path) -> None:
# this ... seems to work? I'm confused
assert tmp_path.joinpath(".flake8").write_text(
"""
assert tmp_path.joinpath(".flake8").write_text("""
[flake8]
select = ASYNC100
extend-select = ASYNC100
"""
)
""")
res = subprocess.run(
["flake8", "--help"], cwd=tmp_path, capture_output=True, check=False
)
Expand All @@ -523,12 +515,10 @@ def test_config_select_error_code(tmp_path: Path) -> None:
# flake8>=6 enforces three-letter error codes in config
@pytest.mark.skipif(flake8 is None, reason="flake8 is not installed")
def test_config_ignore_error_code(tmp_path: Path) -> None:
assert tmp_path.joinpath(".flake8").write_text(
"""
assert tmp_path.joinpath(".flake8").write_text("""
[flake8]
ignore = ASYNC100
"""
)
""")
res = subprocess.run(
["flake8", "--help"],
cwd=tmp_path,
Expand All @@ -545,12 +535,10 @@ def test_config_ignore_error_code(tmp_path: Path) -> None:
# flake8>=6 enforces three-letter error codes in config
@pytest.mark.skipif(flake8 is None, reason="flake8 is not installed")
def test_config_extend_ignore_error_code(tmp_path: Path) -> None:
assert tmp_path.joinpath(".flake8").write_text(
"""
assert tmp_path.joinpath(".flake8").write_text("""
[flake8]
extend-ignore = ASYNC100
"""
)
""")
res = subprocess.run(
["flake8", "--help"],
cwd=tmp_path,
Expand Down
Loading