File: test_integration_zope_interface.py

package info (click to toggle)
setuptools 78.1.1-0.1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,188 kB
  • sloc: python: 65,095; ansic: 204; makefile: 108; xml: 14
file content (54 lines) | stat: -rw-r--r-- 1,652 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import platform
from inspect import cleandoc

import jaraco.path
import pytest

pytestmark = pytest.mark.integration


# For the sake of simplicity this test uses fixtures defined in
# `setuptools.test.fixtures`,
# and it also exercise conditions considered deprecated...
# So if needed this test can be deleted.
@pytest.mark.skipif(
    platform.system() != "Linux",
    reason="only demonstrated to fail on Linux in #4399",
)
def test_interop_pkg_resources_iter_entry_points(tmp_path, venv):
    """
    Importing pkg_resources.iter_entry_points on console_scripts
    seems to cause trouble with zope-interface, when deprecates installation method
    is used. See #4399.
    """
    project = {
        "pkg": {
            "foo.py": cleandoc(
                """
                from pkg_resources import iter_entry_points

                def bar():
                    print("Print me if you can")
                """
            ),
            "setup.py": cleandoc(
                """
                from setuptools import setup, find_packages

                setup(
                    install_requires=["zope-interface==6.4.post2"],
                    entry_points={
                        "console_scripts": [
                            "foo=foo:bar",
                        ],
                    },
                )
                """
            ),
        }
    }
    jaraco.path.build(project, prefix=tmp_path)
    cmd = ["pip", "install", "-e", ".", "--no-use-pep517"]
    venv.run(cmd, cwd=tmp_path / "pkg")  # Needs this version of pkg_resources installed
    out = venv.run(["foo"])
    assert "Print me if you can" in out