diff options
author | Paul Ganssle <pganssle@users.noreply.github.com> | 2018-11-04 12:37:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-04 12:37:40 -0500 |
commit | 46af765c49f548523b8212f6e08e1edb12f22ab6 (patch) | |
tree | 106c81e047b38819f967c3079f379c1ffee0e664 /setuptools/tests/test_build_meta.py | |
parent | 6ed6fe8def487aa77ee67d5ab3adcb2b66814831 (diff) | |
parent | bff67db79c5c1f65cde5fea9919f121dacbc0e7b (diff) | |
download | external_python_setuptools-46af765c49f548523b8212f6e08e1edb12f22ab6.tar.gz external_python_setuptools-46af765c49f548523b8212f6e08e1edb12f22ab6.tar.bz2 external_python_setuptools-46af765c49f548523b8212f6e08e1edb12f22ab6.zip |
Merge pull request #1554 from shashanksingh28/egg_include_setup_py
Egg include setup py
Diffstat (limited to 'setuptools/tests/test_build_meta.py')
-rw-r--r-- | setuptools/tests/test_build_meta.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index c5f4dcaa..940780cf 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -2,9 +2,11 @@ from __future__ import unicode_literals import os import shutil +import tarfile import pytest +from setuptools.build_meta import build_sdist from .files import build_files from .textwrap import DALS from . import py2_only @@ -181,3 +183,34 @@ def test_build_sdist_version_change(build_backend): sdist_name = build_backend.build_sdist("out_sdist") assert os.path.isfile(os.path.join(os.path.abspath("out_sdist"), sdist_name)) + + +def test_build_sdist_setup_py_exists(tmpdir_cwd): + # If build_sdist is called from a script other than setup.py, + # ensure setup.py is include + build_files(defns[0]) + targz_path = build_sdist("temp") + with tarfile.open(os.path.join("temp", targz_path)) as tar: + assert any('setup.py' in name for name in tar.getnames()) + + +def test_build_sdist_setup_py_manifest_excluded(tmpdir_cwd): + # Ensure that MANIFEST.in can exclude setup.py + files = { + 'setup.py': DALS(""" + __import__('setuptools').setup( + name='foo', + version='0.0.0', + py_modules=['hello'] + )"""), + 'hello.py': '', + 'MANIFEST.in': DALS(""" + exclude setup.py + """) + } + + build_files(files) + targz_path = build_sdist("temp") + with tarfile.open(os.path.join("temp", targz_path)) as tar: + assert not any('setup.py' in name for name in tar.getnames()) + |