Skip to content

Commit

Permalink
Add test for relative path imports in build_meta
Browse files Browse the repository at this point in the history
Failing test adapted from PR pypa#1643

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
  • Loading branch information
pganssle and uranusjr committed Feb 3, 2019
1 parent 6d0daf1 commit bd800f4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions setuptools/tests/test_build_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,23 @@ def test_build_sdist_builds_targz_even_if_zip_indicated(self, tmpdir_cwd):

build_backend = self.get_build_backend()
build_backend.build_sdist("temp")

_relative_path_import_files = {
'setup.py': DALS("""
__import__('setuptools').setup(
name='foo',
version=__import__('hello').__version__,
py_modules=['hello']
)"""),
'hello.py': '__version__ = "0.0.0"',
'setup.cfg': DALS("""
[sdist]
formats=zip
""")
}

def test_build_sdist_relative_path_import(self, tmpdir_cwd):
build_files(self._relative_path_import_files)
build_backend = self.get_build_backend()
with pytest.raises(ImportError):
build_backend.build_sdist("temp")

0 comments on commit bd800f4

Please sign in to comment.