Skip to content

Commit 9ea3a76

Browse files
pganssleuranusjr
andcommitted
Add test for relative path imports in build_meta
Failing test adapted from PR pypa#1643 Co-authored-by: Tzu-ping Chung <[email protected]>
1 parent 51bd099 commit 9ea3a76

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

setuptools/tests/test_build_meta.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,23 @@ def test_build_sdist_builds_targz_even_if_zip_indicated(self, tmpdir_cwd):
236236

237237
build_backend = self.get_build_backend()
238238
build_backend.build_sdist("temp")
239+
240+
_relative_path_import_files = {
241+
'setup.py': DALS("""
242+
__import__('setuptools').setup(
243+
name='foo',
244+
version=__import__('hello').__version__,
245+
py_modules=['hello']
246+
)"""),
247+
'hello.py': '__version__ = "0.0.0"',
248+
'setup.cfg': DALS("""
249+
[sdist]
250+
formats=zip
251+
""")
252+
}
253+
254+
def test_build_sdist_relative_path_import(self, tmpdir_cwd):
255+
build_files(self._relative_path_import_files)
256+
build_backend = self.get_build_backend()
257+
with pytest.raises(ImportError):
258+
build_backend.build_sdist("temp")

0 commit comments

Comments
 (0)