Skip to content

Commit 713e0c2

Browse files
authored
Merge pull request #171 from saimn/pytest7
Compat with Pytest 7.0.0rc1
2 parents 9fe2fcd + 25b6886 commit 713e0c2

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

.github/workflows/python-tests.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ jobs:
4444
- os: macos-latest
4545
python-version: 3.8
4646
toxenv: py38-test-pytestdev
47+
- os: ubuntu-latest
48+
python-version: '3.10'
49+
toxenv: py310-test-pytest70
50+
toxargs: --pre
4751

4852
steps:
4953
- uses: actions/checkout@v2
@@ -56,7 +60,7 @@ jobs:
5660
- name: Install Tox
5761
run: python -m pip install tox
5862
- name: Run Tox
59-
run: tox -v -e ${{ matrix.toxenv }}
63+
run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }}
6064

6165
# - name: Slack Notification
6266
# uses: 8398a7/action-slack@v3

CHANGES.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
0.12.0 (unreleased)
1+
0.11.2 (unreleased)
22
===================
33

4+
- Fix version check for pytest 7.0.0rc1. [#171]
5+
46
0.11.1 (2021-11-16)
57
===================
68

pytest_doctestplus/plugin.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
_pytest_version = Version(pytest.__version__)
2424
PYTEST_GT_5 = _pytest_version > Version('5.9.9')
2525
PYTEST_GE_5_4 = _pytest_version >= Version('5.4')
26-
PYTEST_GE_6_3 = _pytest_version.is_devrelease or _pytest_version >= Version('6.3')
27-
PYTEST_GE_7_0 = _pytest_version.is_devrelease or _pytest_version >= Version('7.0')
26+
PYTEST_GE_7_0 = any([_pytest_version.is_devrelease,
27+
_pytest_version.is_prerelease,
28+
_pytest_version >= Version('7.0')])
2829

2930
comment_characters = {
3031
'.txt': '#',
@@ -192,7 +193,7 @@ class DocTestModulePlus(doctest_plugin.DoctestModule):
192193
def collect(self):
193194
# When running directly from pytest we need to make sure that we
194195
# don't accidentally import setup.py!
195-
if PYTEST_GE_6_3:
196+
if PYTEST_GE_7_0:
196197
fspath = self.path
197198
filepath = self.path.name
198199
else:
@@ -206,9 +207,6 @@ def collect(self):
206207
module = self.config.pluginmanager._importconftest(
207208
self.path, self.config.getoption("importmode"),
208209
rootpath=self.config.rootpath)
209-
elif PYTEST_GE_6_3:
210-
module = self.config.pluginmanager._importconftest(
211-
self.path, self.config.getoption("importmode"))
212210
elif PYTEST_GT_5:
213211
module = self.config.pluginmanager._importconftest(
214212
self.fspath, self.config.getoption("importmode"))
@@ -220,7 +218,7 @@ def collect(self):
220218
if PYTEST_GT_5:
221219
from _pytest.pathlib import import_path
222220

223-
if PYTEST_GE_6_3:
221+
if PYTEST_GE_7_0:
224222
module = import_path(fspath, root=self.config.rootpath)
225223
elif PYTEST_GT_5:
226224
module = import_path(fspath)
@@ -284,7 +282,7 @@ def collect(self):
284282
class DocTestTextfilePlus(pytest.Module):
285283

286284
def collect(self):
287-
if PYTEST_GE_6_3:
285+
if PYTEST_GE_7_0:
288286
fspath = self.path
289287
filepath = self.path.name
290288
else:
@@ -475,7 +473,7 @@ def pytest_ignore_collect(self, path, config):
475473
Skip paths that match any of the doctest_norecursedirs patterns or
476474
if doctest_only is True then skip all regular test files (eg test_*.py).
477475
"""
478-
if PYTEST_GE_6_3:
476+
if PYTEST_GE_7_0:
479477
dirpath = Path(path).parent
480478
else:
481479
dirpath = path.dirpath()

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ classifiers =
1515
Programming Language :: Python :: 3.7
1616
Programming Language :: Python :: 3.8
1717
Programming Language :: Python :: 3.9
18+
Programming Language :: Python :: 3.10
1819
Programming Language :: Python :: Implementation :: CPython
1920
Topic :: Software Development :: Testing
2021
Topic :: Utilities

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py{37,38,39}-test
3+
py{37,38,39,310}-test
44
codestyle
55
requires =
66
setuptools >= 30.3.0
@@ -19,6 +19,7 @@ deps =
1919
pytest60: pytest==6.0.*
2020
pytest61: pytest==6.1.*
2121
pytest62: pytest==6.2.*
22+
pytest70: pytest==7.0.*
2223
pytestdev: git+https://github.com/pytest-dev/pytest#egg=pytest
2324

2425
extras =

0 commit comments

Comments
 (0)