aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests
diff options
context:
space:
mode:
authorDeniz Taneli <7292227+dtaneli@users.noreply.github.com>2018-10-28 11:25:18 +0000
committerDeniz Taneli <7292227+dtaneli@users.noreply.github.com>2018-10-28 11:25:18 +0000
commit08bff86fe64cfb05d9ecd6dbf436fa706ecc8440 (patch)
tree1d281b008945c6e7d81df372c04f0b57648c542e /setuptools/tests
parent00b172d6b4a4f3fb1546dd0c2fc53ec2d4087b00 (diff)
downloadexternal_python_setuptools-08bff86fe64cfb05d9ecd6dbf436fa706ecc8440.tar.gz
external_python_setuptools-08bff86fe64cfb05d9ecd6dbf436fa706ecc8440.tar.bz2
external_python_setuptools-08bff86fe64cfb05d9ecd6dbf436fa706ecc8440.zip
Make the new tests parametrized
Diffstat (limited to 'setuptools/tests')
-rw-r--r--setuptools/tests/test_egg_info.py79
1 files changed, 19 insertions, 60 deletions
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 2ca91e85..76c31ada 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -486,84 +486,39 @@ class TestEggInfo:
pkg_info_text = pkginfo_file.read()
assert 'Provides-Extra:' not in pkg_info_text
- def test_setup_cfg_with_license(self, tmpdir_cwd, env):
- self._create_project()
- build_files({
+ @pytest.mark.parametrize("files, license_in_sources", [
+ ({
'setup.cfg': DALS("""
[metadata]
license_file = LICENSE
"""),
'LICENSE': DALS("Test license")
- })
- environ = os.environ.copy().update(
- HOME=env.paths['home'],
- )
- environment.run_setup_py(
- cmd=['egg_info'],
- pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
- data_stream=1,
- env=environ,
- )
- egg_info_dir = os.path.join('.', 'foo.egg-info')
- with open(os.path.join(egg_info_dir, 'SOURCES.txt')) as sources_file:
- sources_text = sources_file.read()
- assert 'LICENSE' in sources_text
-
- def test_setup_cfg_with_invalid_license(self, tmpdir_cwd, env):
- self._create_project()
- build_files({
+ }, True), # with license
+ ({
'setup.cfg': DALS("""
[metadata]
license_file = INVALID_LICENSE
"""),
'LICENSE': DALS("Test license")
- })
- environ = os.environ.copy().update(
- HOME=env.paths['home'],
- )
- environment.run_setup_py(
- cmd=['egg_info'],
- pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
- data_stream=1,
- env=environ,
- )
- egg_info_dir = os.path.join('.', 'foo.egg-info')
- with open(os.path.join(egg_info_dir, 'SOURCES.txt')) as sources_file:
- sources_text = sources_file.read()
- assert 'LICENSE' not in sources_text
- assert 'INVALID_LICENSE' not in sources_text
-
- def test_setup_cfg_with_no_license(self, tmpdir_cwd, env):
- self._create_project()
- build_files({
+ }, False), # with an invalid license
+ ({
'setup.cfg': DALS("""
"""),
'LICENSE': DALS("Test license")
- })
- environ = os.environ.copy().update(
- HOME=env.paths['home'],
- )
- environment.run_setup_py(
- cmd=['egg_info'],
- pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
- data_stream=1,
- env=environ,
- )
- egg_info_dir = os.path.join('.', 'foo.egg-info')
- with open(os.path.join(egg_info_dir, 'SOURCES.txt')) as sources_file:
- sources_text = sources_file.read()
- assert 'LICENSE' not in sources_text
-
- def test_setup_cfg_with_license_excluded(self, tmpdir_cwd, env):
- self._create_project()
- build_files({
+ }, False), # no license_file attribute
+ ({
'setup.cfg': DALS("""
[metadata]
license_file = LICENSE
"""),
'MANIFEST.in': DALS("exclude LICENSE"),
'LICENSE': DALS("Test license")
- })
+ }, False) # license file is manually excluded
+ ])
+ def test_setup_cfg_license_file(
+ self, tmpdir_cwd, env, files, license_in_sources):
+ self._create_project()
+ build_files(files)
environ = os.environ.copy().update(
HOME=env.paths['home'],
)
@@ -576,7 +531,11 @@ class TestEggInfo:
egg_info_dir = os.path.join('.', 'foo.egg-info')
with open(os.path.join(egg_info_dir, 'SOURCES.txt')) as sources_file:
sources_text = sources_file.read()
- assert 'LICENSE' not in sources_text
+ if license_in_sources:
+ assert 'LICENSE' in sources_text
+ else:
+ assert 'LICENSE' not in sources_text
+ assert 'INVALID_LICENSE' not in sources_text # for invalid license test
def test_long_description_content_type(self, tmpdir_cwd, env):
# Test that specifying a `long_description_content_type` keyword arg to