Skip to content

Commit e43aa84

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 db81330 commit e43aa84

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

setuptools/tests/test_build_meta.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,22 @@ def test_build_sdist_builds_targz_even_if_zip_indicated(self,
230230

231231
build_files(files)
232232
build_backend.build_sdist("temp")
233+
234+
_relative_path_import_files = {
235+
'setup.py': DALS("""
236+
__import__('setuptools').setup(
237+
name='foo',
238+
version=__import__('hello').__version__,
239+
py_modules=['hello']
240+
)"""),
241+
'hello.py': '__version__ = "0.0.0"',
242+
'setup.cfg': DALS("""
243+
[sdist]
244+
formats=zip
245+
""")
246+
}
247+
248+
def test_build_sdist_relative_path_import(self, build_backend, tmpdir_cwd):
249+
build_files(self._relative_path_import_files)
250+
with pytest.raises(ImportError):
251+
build_backend.build_sdist("temp")

0 commit comments

Comments
 (0)