Skip to content

[PR #13444/c7aabccd backport][8.3.x] testing: skip pkg_resources tests if modern setuptools #13446

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

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
10 changes: 8 additions & 2 deletions testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import sys
import types

import setuptools

from _pytest.config import ExitCode
from _pytest.pathlib import symlink_or_skip
from _pytest.pytester import Pytester
Expand Down Expand Up @@ -721,10 +723,14 @@ def test_cmdline_python_package(self, pytester: Pytester, monkeypatch) -> None:
assert result.ret != 0
result.stderr.fnmatch_lines(["*not*found*test_missing*"])

def test_cmdline_python_namespace_package(
@pytest.mark.skipif(
int(setuptools.__version__.split(".")[0]) >= 80,
reason="modern setuptools removing pkg_resources",
)
def test_cmdline_python_legacy_namespace_package(
self, pytester: Pytester, monkeypatch
) -> None:
"""Test --pyargs option with namespace packages (#1567).
"""Test --pyargs option with legacy namespace packages (#1567).

Ref: https://packaging.python.org/guides/packaging-namespace-packages/
"""
Expand Down
6 changes: 6 additions & 0 deletions testing/test_monkeypatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import textwrap
from typing import Generator

import setuptools

from _pytest.monkeypatch import MonkeyPatch
from _pytest.pytester import Pytester
import pytest
Expand Down Expand Up @@ -429,6 +431,10 @@ class A:


@pytest.mark.filterwarnings(r"ignore:.*\bpkg_resources\b:DeprecationWarning")
@pytest.mark.skipif(
int(setuptools.__version__.split(".")[0]) >= 80,
reason="modern setuptools removing pkg_resources",
)
def test_syspath_prepend_with_namespace_packages(
pytester: Pytester, monkeypatch: MonkeyPatch
) -> None:
Expand Down
Loading