Skip to content

Commit

Permalink
Add a better workaround for 3260 in tests for editable tree
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed May 19, 2022
1 parent 2df3434 commit 50c1d09
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions setuptools/tests/test_editable_install.py
Expand Up @@ -17,7 +17,6 @@

from . import contexts, namespaces

from setuptools._deprecation_warning import SetuptoolsDeprecationWarning
from setuptools._importlib import resources as importlib_resources
from setuptools.command.editable_wheel import (
_LinkTree,
Expand Down Expand Up @@ -570,6 +569,12 @@ def test_editable_install(self, tmp_path, venv, layout, editable_mode):
class TestLinkTree:
FILES = deepcopy(TestOverallBehaviour.EXAMPLES["src-layout"])
FILES["pyproject.toml"] += dedent("""\
[tool.setuptools]
# Temporary workaround: both `include-package-data` and `package-data` configs
# can be removed after #3260 is fixed.
include-package-data = false
package-data = {"*" = ["*.txt"]}
[tool.setuptools.packages.find]
where = ["src"]
exclude = ["*.subpackage*"]
Expand All @@ -591,19 +596,15 @@ def test_generated_tree(self, tmp_path):
unpacked.mkdir()

make_tree = _LinkTree(dist, name, build, tmp)
with pytest.warns(SetuptoolsDeprecationWarning, match="would be ignored"):
# Transitional warning related to #3260, can be removed after is fixed
make_tree(unpacked)
make_tree(unpacked)

mod1 = next(build.glob("**/mod1.py"))
expected = tmp_path / "src/mypkg/mod1.py"
assert_link_to(mod1, expected)

with pytest.raises(AssertionError): # ignore problems caused by #3260
# Ensure excluded packages don't show up
assert next(build.glob("**/subpackage"), None) is None
assert next(build.glob("**/mod2.py"), None) is None
assert next(build.glob("**/resource_file.txt"), None) is None
assert next(build.glob("**/subpackage"), None) is None
assert next(build.glob("**/mod2.py"), None) is None
assert next(build.glob("**/resource_file.txt"), None) is None

assert next(build.glob("**/resource.not_in_manifest"), None) is None

Expand All @@ -622,8 +623,7 @@ def test_strict_install(self, tmp_path, venv, monkeypatch):
print(ex)
"""
out = venv.run(["python", "-c", dedent(cmd_import_error)])
with pytest.raises(AssertionError): # ignore problems caused by #3260
assert b"cannot import name 'subpackage'" in out
assert b"cannot import name 'subpackage'" in out

# Ensure resource files excluded from distribution are not reachable
cmd_get_resource = """\
Expand Down

0 comments on commit 50c1d09

Please sign in to comment.