diff options
| author | Simone Pierazzini <s.pierazzini@nextworks.it> | 2021-02-18 06:40:17 +0100 |
|---|---|---|
| committer | Simone Pierazzini <s.pierazzini@nextworks.it> | 2021-02-18 06:40:17 +0100 |
| commit | cb00954729e1deaef431697bae8b8a6a7198c2ce (patch) | |
| tree | 376810f7e9e0a6ca10a25e5dd4eab5f9328b81b9 /setuptools/tests/test_config.py | |
| parent | c121d289da5d19cf6df2bf6b64ac28916a060161 (diff) | |
| download | python-setuptools-git-cb00954729e1deaef431697bae8b8a6a7198c2ce.tar.gz | |
Correctly parse cmdclass in setup.cfg. Fixes #2570
Diffstat (limited to 'setuptools/tests/test_config.py')
| -rw-r--r-- | setuptools/tests/test_config.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 1dee1271..16892cb1 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -1,3 +1,6 @@ +import types +import sys + import contextlib import configparser @@ -7,6 +10,7 @@ from distutils.errors import DistutilsOptionError, DistutilsFileError from mock import patch from setuptools.dist import Distribution, _Distribution from setuptools.config import ConfigHandler, read_configuration +from distutils.core import Command from .textwrap import DALS @@ -853,6 +857,26 @@ class TestOptions: with get_dist(tmpdir) as dist: dist.parse_config_files() + def test_cmdclass(self, tmpdir): + class CustomCmd(Command): + pass + + m = types.ModuleType('custom_build', 'test package') + + m.__dict__['CustomCmd'] = CustomCmd + + sys.modules['custom_build'] = m + + fake_env( + tmpdir, + '[options]\n' + 'cmdclass =\n' + ' customcmd = custom_build.CustomCmd\n' + ) + + with get_dist(tmpdir) as dist: + assert dist.cmdclass == {'customcmd': CustomCmd} + saved_dist_init = _Distribution.__init__ |
