diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2019-01-27 10:06:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-27 10:06:28 -0500 |
commit | 97e8ad4f5ff7793729e9c8be38e0901e3ad8d09e (patch) | |
tree | 76c5b37e3a56a232b4b5b66ab7e933edbe64cd25 /setuptools/tests | |
parent | 78fd73026ad7284819936b651f7cfbe8a1ec98c8 (diff) | |
parent | 0551421f082eea3f633bc6be23c16a04483aca98 (diff) | |
download | external_python_setuptools-97e8ad4f5ff7793729e9c8be38e0901e3ad8d09e.tar.gz external_python_setuptools-97e8ad4f5ff7793729e9c8be38e0901e3ad8d09e.tar.bz2 external_python_setuptools-97e8ad4f5ff7793729e9c8be38e0901e3ad8d09e.zip |
Merge pull request #1536 from dtaneli/license-fix-357
Setuptools will install licenses if included in setup.cfg
Diffstat (limited to 'setuptools/tests')
-rw-r--r-- | setuptools/tests/test_egg_info.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index d5fa2558..db9c3873 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -518,6 +518,55 @@ class TestEggInfo: pkg_info_text = pkginfo_file.read() assert 'Provides-Extra:' not in pkg_info_text + @pytest.mark.parametrize("files, license_in_sources", [ + ({ + 'setup.cfg': DALS(""" + [metadata] + license_file = LICENSE + """), + 'LICENSE': DALS("Test license") + }, True), # with license + ({ + 'setup.cfg': DALS(""" + [metadata] + license_file = INVALID_LICENSE + """), + 'LICENSE': DALS("Test license") + }, False), # with an invalid license + ({ + 'setup.cfg': DALS(""" + """), + 'LICENSE': DALS("Test license") + }, 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) + + environment.run_setup_py( + cmd=['egg_info'], + pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]) + ) + 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() + + 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 # the `setup` function results in writing a `Description-Content-Type` |