CI: Remove now-uneeded workarounds (#4665)

This commit is contained in:
cobalt 2025-05-25 18:23:42 -05:00 committed by GitHub
parent 2630801f95
commit 71e380aedf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 40 deletions

View File

@ -48,7 +48,9 @@ repos:
- types-PyYAML - types-PyYAML
- types-atheris - types-atheris
- tomli >= 0.2.6, < 2.0.0 - tomli >= 0.2.6, < 2.0.0
- click >= 8.1.0, != 8.1.4, != 8.1.5 - click >= 8.2.0
# Click is intentionally out-of-sync with pyproject.toml
# v8.2 has breaking changes. We work around them at runtime, but we need the newer stubs.
- packaging >= 22.0 - packaging >= 22.0
- platformdirs >= 2.1.0 - platformdirs >= 2.1.0
- pytokens >= 0.1.10 - pytokens >= 0.1.10

View File

@ -5,14 +5,11 @@
a coverage-guided fuzzer I'm working on. a coverage-guided fuzzer I'm working on.
""" """
import re
import hypothesmith import hypothesmith
from hypothesis import HealthCheck, given, settings from hypothesis import HealthCheck, given, settings
from hypothesis import strategies as st from hypothesis import strategies as st
import black import black
from blib2to3.pgen2.tokenize import TokenError
# This test uses the Hypothesis and Hypothesmith libraries to generate random # This test uses the Hypothesis and Hypothesmith libraries to generate random
@ -45,23 +42,7 @@ def test_idempotent_any_syntatically_valid_python(
compile(src_contents, "<string>", "exec") # else the bug is in hypothesmith compile(src_contents, "<string>", "exec") # else the bug is in hypothesmith
# Then format the code... # Then format the code...
try: dst_contents = black.format_str(src_contents, mode=mode)
dst_contents = black.format_str(src_contents, mode=mode)
except black.InvalidInput:
# This is a bug - if it's valid Python code, as above, Black should be
# able to cope with it. See issues #970, #1012
# TODO: remove this try-except block when issues are resolved.
return
except TokenError as e:
if ( # Special-case logic for backslashes followed by newlines or end-of-input
e.args[0] == "EOF in multi-line statement"
and re.search(r"\\($|\r?\n)", src_contents) is not None
):
# This is a bug - if it's valid Python code, as above, Black should be
# able to cope with it. See issue #1012.
# TODO: remove this block when the issue is resolved.
return
raise
# And check that we got equivalent and stable output. # And check that we got equivalent and stable output.
black.assert_equivalent(src_contents, dst_contents) black.assert_equivalent(src_contents, dst_contents)

View File

@ -119,7 +119,7 @@ def __init__(self) -> None:
if Version(imp_version("click")) >= Version("8.2.0"): if Version(imp_version("click")) >= Version("8.2.0"):
super().__init__() super().__init__()
else: else:
super().__init__(mix_stderr=False) super().__init__(mix_stderr=False) # type: ignore
def invokeBlack( def invokeBlack(

24
tox.ini
View File

@ -13,18 +13,16 @@ skip_install = True
recreate = True recreate = True
deps = deps =
-r{toxinidir}/test_requirements.txt -r{toxinidir}/test_requirements.txt
; parallelization is disabled on CI because pytest-dev/pytest-xdist#620 occurs too frequently
; local runs can stay parallelized since they aren't rolling the dice so many times as like on CI
commands = commands =
pip install -e .[d] pip install -e .[d]
coverage erase coverage erase
pytest tests --run-optional no_jupyter \ pytest tests --run-optional no_jupyter \
!ci: --numprocesses auto \ --numprocesses auto \
--cov {posargs} --cov {posargs}
pip install -e .[jupyter] pip install -e .[jupyter]
pytest tests --run-optional jupyter \ pytest tests --run-optional jupyter \
-m jupyter \ -m jupyter \
!ci: --numprocesses auto \ --numprocesses auto \
--cov --cov-append {posargs} --cov --cov-append {posargs}
coverage report coverage report
@ -34,20 +32,15 @@ skip_install = True
recreate = True recreate = True
deps = deps =
-r{toxinidir}/test_requirements.txt -r{toxinidir}/test_requirements.txt
; a separate worker is required in ci due to https://foss.heptapod.net/pypy/pypy/-/issues/3317
; this seems to cause tox to wait forever
; remove this when pypy releases the bugfix
commands = commands =
pip install -e .[d] pip install -e .[d]
pytest tests \ pytest tests \
--run-optional no_jupyter \ --run-optional no_jupyter \
!ci: --numprocesses auto \ --numprocesses auto
ci: --numprocesses 1
pip install -e .[jupyter] pip install -e .[jupyter]
pytest tests --run-optional jupyter \ pytest tests --run-optional jupyter \
-m jupyter \ -m jupyter \
!ci: --numprocesses auto \ --numprocesses auto
ci: --numprocesses 1
[testenv:{,ci-}311] [testenv:{,ci-}311]
setenv = setenv =
@ -59,22 +52,17 @@ deps =
; We currently need > aiohttp 3.8.1 that is on PyPI for 3.11 ; We currently need > aiohttp 3.8.1 that is on PyPI for 3.11
git+https://github.com/aio-libs/aiohttp git+https://github.com/aio-libs/aiohttp
-r{toxinidir}/test_requirements.txt -r{toxinidir}/test_requirements.txt
; a separate worker is required in ci due to https://foss.heptapod.net/pypy/pypy/-/issues/3317
; this seems to cause tox to wait forever
; remove this when pypy releases the bugfix
commands = commands =
pip install -e .[d] pip install -e .[d]
coverage erase coverage erase
pytest tests \ pytest tests \
--run-optional no_jupyter \ --run-optional no_jupyter \
!ci: --numprocesses auto \ --numprocesses auto \
ci: --numprocesses 1 \
--cov {posargs} --cov {posargs}
pip install -e .[jupyter] pip install -e .[jupyter]
pytest tests --run-optional jupyter \ pytest tests --run-optional jupyter \
-m jupyter \ -m jupyter \
!ci: --numprocesses auto \ --numprocesses auto \
ci: --numprocesses 1 \
--cov --cov-append {posargs} --cov --cov-append {posargs}
coverage report coverage report