Skip to content

Commit

Permalink
Upgrade py-pytest-cov from 2.9.0 to 4.0
Browse files Browse the repository at this point in the history
Summary:
This is required so py-pytest-cov is functional with newer versions of
py-pytest-xdist [1].

Backport patches from upstream commit to [selectively] add 3.11 support
to make some of the tests not fail when run with newer versions of
coverage.py [2].

While here, appease portlint by shifting where variables (`CONFLICTS`,
etc) are defined.

1. pytest-dev/pytest-cov#422
2. pytest-dev/pytest-cov#570

PR:	269360
Co-Authored-With:	Yuri Victorovich <yuri@freebsd.org>

Test Plan: `make test` passes with this change.

Reviewers: dbaio

Subscribers: mat, yuri

Differential Revision: https://reviews.freebsd.org/D39035
  • Loading branch information
ngie-eign committed Jun 24, 2023
1 parent fafd3c2 commit 140481c
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 9 deletions.
20 changes: 14 additions & 6 deletions devel/py-pytest-cov/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PORTNAME= pytest-cov
PORTVERSION= 2.9.0
PORTVERSION= 4.0.0
CATEGORIES= devel python
MASTER_SITES= PYPI
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
Expand All @@ -11,14 +11,22 @@ WWW= https://github.com/pytest-dev/pytest-cov
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE

CONFLICTS_INSTALL= ${PYTHON_PKGNAMEPREFIX}pytest4-cov

RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}coverage>=4.4:devel/py-coverage@${PY_FLAVOR} \
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}coverage>=5.2.1:devel/py-coverage@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pytest>=3.6:devel/py-pytest@${PY_FLAVOR}
TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}fields>0:devel/py-fields@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}hunter>0:devel/py-hunter@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}process-tests>0:devel/py-process-tests@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pytest-xdist>0:devel/py-pytest-xdist@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}virtualenv>0:devel/py-virtualenv@${PY_FLAVOR}

USES= python:3.6+
USE_PYTHON= autoplist concurrent distutils
USES= python:3.7+
USE_PYTHON= autoplist concurrent distutils pytest

CONFLICTS_INSTALL= ${PYTHON_PKGNAMEPREFIX}pytest4-cov

NO_ARCH= yes

TEST_ARGS+= -p pytester

.include <bsd.port.mk>
6 changes: 3 additions & 3 deletions devel/py-pytest-cov/distinfo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
TIMESTAMP = 1590933452
SHA256 (pytest-cov-2.9.0.tar.gz) = b6a814b8ed6247bd81ff47f038511b57fe1ce7f4cc25b9106f1a4b106f1d9322
SIZE (pytest-cov-2.9.0.tar.gz) = 54269
TIMESTAMP = 1678653801
SHA256 (pytest-cov-4.0.0.tar.gz) = 996b79efde6433cdbd0088872dbc5fb3ed7fe1578b68cdbba634f14bb8dd0470
SIZE (pytest-cov-4.0.0.tar.gz) = 62013
24 changes: 24 additions & 0 deletions devel/py-pytest-cov/files/patch-setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--- setup.py.orig 2022-09-28 15:20:20 UTC
+++ setup.py
@@ -111,11 +111,11 @@ setup(
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
- 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
+ 'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Testing',
@@ -133,7 +133,7 @@ setup(
'pytest>=4.6',
'coverage[toml]>=5.2.1'
],
- python_requires='>=3.6',
+ python_requires='>=3.7',
extras_require={
'testing': [
'fields',
19 changes: 19 additions & 0 deletions devel/py-pytest-cov/files/patch-tests_test__pytest__cov.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- tests/test_pytest_cov.py.orig 2022-09-28 15:03:24 UTC
+++ tests/test_pytest_cov.py
@@ -1556,6 +1556,8 @@ def test_foo():
SCRIPT_SIMPLE_RESULT = '4 * 100%'


+@pytest.mark.skipif('tuple(int(x) for x in xdist.__version__.split(".")) >= (2, 5, 0)',
+ reason="--boxed option was removed in version 2.5.0")
@pytest.mark.skipif('sys.platform == "win32"')
def test_dist_boxed(testdir):
script = testdir.makepyfile(SCRIPT_SIMPLE)
@@ -1916,6 +1918,7 @@ EXPECTED_CONTEXTS = {


@pytest.mark.skipif("coverage.version_info < (5, 0)")
+@pytest.mark.skipif("coverage.version_info > (6, 4)")
@xdist_params
def test_contexts(pytester, testdir, opts):
with open(os.path.join(os.path.dirname(__file__), "contextful.py")) as f:

0 comments on commit 140481c

Please sign in to comment.