Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test 3.12 #141

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']

env:
PYTHON: ${{ matrix.python-version }}
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ classifiers = [
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Internet',
'Typing :: Typed',
Expand Down Expand Up @@ -78,7 +79,7 @@ color = true
line-length = 120
target-version = ['py37', 'py38', 'py39', 'py310', 'py311']
skip-string-normalization = true
extend-exclude = ['tests/test_expr_render.py']
extend-exclude = 'tests/test_expr_render.py'

[tool.ruff]
line-length = 120
Expand Down
8 changes: 4 additions & 4 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=requirements/docs.txt --resolver=backtracking requirements/docs.in
# pip-compile --output-file=requirements/docs.txt requirements/docs.in
#
ansi2html==1.8.0
# via -r requirements/docs.in
Expand Down Expand Up @@ -48,17 +48,17 @@ mkdocs-material-extensions==1.1.1
# via mkdocs-material
mkdocs-simple-hooks==0.1.5
# via -r requirements/docs.in
numpy==1.24.2
numpy==1.26.0
# via -r requirements/docs.in
packaging==23.0
# via mkdocs
pygments==2.15.0
pygments==2.16.1
# via mkdocs-material
pymdown-extensions==10.0
# via mkdocs-material
python-dateutil==2.8.2
# via ghp-import
pyyaml==6.0
pyyaml==6.0.1
# via
# mkdocs
# pymdown-extensions
Expand Down
8 changes: 4 additions & 4 deletions requirements/linting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#
attrs==22.2.0
# via pytest
black==23.3.0
black==23.9.1
# via -r requirements/linting.in
click==8.1.3
# via black
exceptiongroup==1.1.1
exceptiongroup==1.1.3
# via pytest
iniconfig==2.0.0
# via pytest
Expand All @@ -30,7 +30,7 @@ platformdirs==3.2.0
# via black
pluggy==1.0.0
# via pytest
pytest==7.2.2
pytest==7.4.2
# via -r requirements/linting.in
ruff==0.0.261
# via -r requirements/linting.in
Expand All @@ -41,7 +41,7 @@ tomli==2.0.1
# black
# mypy
# pytest
typing-extensions==4.5.0
typing-extensions==4.8.0
# via
# mypy
# sqlalchemy
8 changes: 5 additions & 3 deletions requirements/pyproject.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=requirements/pyproject.txt --resolver=backtracking pyproject.toml
# pip-compile --output-file=requirements/pyproject.txt pyproject.toml
#
asttokens==2.2.1
asttokens==2.4.0
# via devtools (pyproject.toml)
executing==1.2.0
executing==2.0.0
# via devtools (pyproject.toml)
pygments==2.16.1
# via devtools (pyproject.toml)
six==1.16.0
# via asttokens
19 changes: 10 additions & 9 deletions requirements/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=requirements/testing.txt --resolver=backtracking requirements/testing.in
# pip-compile --output-file=requirements/testing.txt requirements/testing.in
#
asyncpg==0.27.0 ; python_version >= "3.8"
asyncpg==0.28.0 ; python_version >= "3.8"
# via -r requirements/testing.in
attrs==22.2.0
# via pytest
black==23.3.0
black==23.9.1
# via -r requirements/testing.in
click==8.1.3
# via black
coverage[toml]==7.2.2
# via -r requirements/testing.in
exceptiongroup==1.1.3
# via pytest
greenlet==3.0.0rc3
# via sqlalchemy
iniconfig==2.0.0
# via pytest
markdown-it-py==2.2.0
Expand All @@ -26,7 +26,7 @@ multidict==6.0.4 ; python_version >= "3.8"
# via -r requirements/testing.in
mypy-extensions==1.0.0
# via black
numpy==1.24.2 ; python_version >= "3.8"
numpy==1.26.0 ; python_version >= "3.8"
# via -r requirements/testing.in
packaging==23.0
# via
Expand All @@ -40,9 +40,9 @@ pluggy==1.0.0
# via pytest
pydantic==1.10.7
# via -r requirements/testing.in
pygments==2.15.0
pygments==2.16.1
# via rich
pytest==7.2.2
pytest==7.4.2
# via
# -r requirements/testing.in
# pytest-mock
Expand All @@ -60,7 +60,8 @@ tomli==2.0.1
# black
# coverage
# pytest
typing-extensions==4.5.0
typing-extensions==4.8.0
# via
# black
# pydantic
# sqlalchemy
14 changes: 4 additions & 10 deletions tests/test_insert_assert.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import sys

import pytest
from pytest_pretty import ansi_escape

from devtools.pytest_plugin import load_black

pytestmark = pytest.mark.skipif(sys.version_info < (3, 8), reason='requires Python 3.8+')


config = "pytest_plugins = ['devtools.pytest_plugin']"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting ValueError: Plugin already registered: devtools.pytest_plugin and removing this fixed it for me locally.

# language=Python
default_test = """\
def test_ok():
Expand All @@ -22,7 +22,6 @@ def test_string_assert(insert_assert):

def test_insert_assert(pytester_pretty):
os.environ.pop('CI', None)
pytester_pretty.makeconftest(config)
test_file = pytester_pretty.makepyfile(default_test)
result = pytester_pretty.runpytest()
result.assert_outcomes(passed=2)
Expand All @@ -40,7 +39,6 @@ def test_insert_assert(pytester_pretty):

def test_insert_assert_no_pretty(pytester):
os.environ.pop('CI', None)
pytester.makeconftest(config)
test_file = pytester.makepyfile(default_test)
result = pytester.runpytest('-p', 'no:pretty')
result.assert_outcomes(passed=2)
Expand All @@ -57,7 +55,6 @@ def test_insert_assert_no_pretty(pytester):

def test_insert_assert_print(pytester_pretty, capsys):
os.environ.pop('CI', None)
pytester_pretty.makeconftest(config)
test_file = pytester_pretty.makepyfile(default_test)
# assert r == 0
result = pytester_pretty.runpytest('--insert-assert-print')
Expand All @@ -70,17 +67,15 @@ def test_insert_assert_print(pytester_pretty, capsys):

def test_insert_assert_fail(pytester_pretty):
os.environ.pop('CI', None)
pytester_pretty.makeconftest(config)
test_file = pytester_pretty.makepyfile(default_test)
# assert r == 0
result = pytester_pretty.runpytest()
assert result.parseoutcomes() == {'passed': 2, 'warning': 1, 'insert': 1}
assert result.parseoutcomes() == {'passed': 2, 'insert': 1}
assert test_file.read_text() != default_test


def test_deep(pytester_pretty):
os.environ.pop('CI', None)
pytester_pretty.makeconftest(config)
# language=Python
test_file = pytester_pretty.makepyfile(
"""
Expand All @@ -103,7 +98,6 @@ def test_deep(insert_assert):

def test_enum(pytester_pretty, capsys):
os.environ.pop('CI', None)
pytester_pretty.makeconftest(config)
# language=Python
pytester_pretty.makepyfile(
"""
Expand All @@ -121,7 +115,8 @@ def test_deep(insert_assert):
result = pytester_pretty.runpytest('--insert-assert-print')
result.assert_outcomes(passed=1)
captured = capsys.readouterr()
assert ' assert x == Foo.A\n' in captured.out
out = ansi_escape.sub('', captured.out).strip() # clean colors
assert ' assert x == Foo.A\n' in out


def test_insert_assert_black(tmp_path):
Expand All @@ -145,7 +140,6 @@ def test_insert_assert_black(tmp_path):

def test_insert_assert_repeat(pytester_pretty, capsys):
os.environ.pop('CI', None)
pytester_pretty.makeconftest(config)
test_file = pytester_pretty.makepyfile(
"""\
import pytest
Expand Down