diff options
| author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-02-20 17:33:39 +0000 |
|---|---|---|
| committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-03-05 09:14:34 +0000 |
| commit | ed3b7c3f4afb19df5ea4c5de61a5bff118dec5a6 (patch) | |
| tree | 59fa610eb2218cf4013a7492ee451371a5360e0b /setuptools/tests | |
| parent | 82b4ed83cbb12aea662b0ca5be275f38ab18bc2b (diff) | |
| download | python-setuptools-git-ed3b7c3f4afb19df5ea4c5de61a5bff118dec5a6.tar.gz | |
Don't overwrite if the user specifies empty packages/py_modules
Diffstat (limited to 'setuptools/tests')
| -rw-r--r-- | setuptools/tests/test_config_discovery.py | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/setuptools/tests/test_config_discovery.py b/setuptools/tests/test_config_discovery.py index c27ee319..e4ccc648 100644 --- a/setuptools/tests/test_config_discovery.py +++ b/setuptools/tests/test_config_discovery.py @@ -1,14 +1,16 @@ import os import sys from configparser import ConfigParser - -import pytest +from itertools import product from setuptools.command.sdist import sdist from setuptools.dist import Distribution +import pytest + from .contexts import quiet from .integration.helpers import get_sdist_members, get_wheel_members, run +from .textwrap import DALS class TestDiscoverPackagesAndPyModules: @@ -105,6 +107,58 @@ class TestDiscoverPackagesAndPyModules: assert "build" not in files assert "dist" not in files + PURPOSEFULLY_EMPY = { + "setup.cfg": DALS( + """ + [metadata] + name = myproj + version = 0.0.0 + + [options] + {param} = + """ + ), + "setup.py": DALS( + """ + __import__('setuptools').setup( + name="myproj", + version="0.0.0", + {param}=[] + ) + """ + ), + "pyproject.toml": DALS( + """ + [build-system] + requires = [] + build-backend = 'setuptools.build_meta' + """ + ) + } + + @pytest.mark.parametrize( + "config_file, param, circumstance", + product(["setup.cfg", "setup.py"], ["packages", "py_modules"], FILES.keys()) + ) + def test_purposefully_empty(self, tmp_path, config_file, param, circumstance): + files = self.FILES[circumstance] + _populate_project_dir(tmp_path, files, {}) + config = self.PURPOSEFULLY_EMPY[config_file].format(param=param) + (tmp_path / config_file).write_text(config) + + # Make sure build works with or without setup.cfg + pyproject = self.PURPOSEFULLY_EMPY["pyproject.toml"] + (tmp_path / "pyproject.toml").write_text(pyproject) + + _run_build(tmp_path) + + wheel_files = get_wheel_members(next(tmp_path.glob("dist/*.whl"))) + print("~~~~~ wheel_members ~~~~~") + print('\n'.join(wheel_files)) + for file in files: + name = file.replace("src/", "") + assert name not in wheel_files + class TestNoConfig: DEFAULT_VERSION = "0.0.0" # Default version given by setuptools |
