diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2020-05-15 06:13:10 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-05-15 06:13:10 -0400 |
commit | 619e229c9777f0ee0851d8c5c94caaad7d89d434 (patch) | |
tree | 2013eec1df4def402792a3b932d904b714b7e493 /setuptools/tests/test_setuptools.py | |
parent | b0657c80db7891a9eca038199d5d4c2e2bafed03 (diff) | |
parent | e04c75ab906caadff4609ef34de8973c8e92eff8 (diff) | |
download | external_python_setuptools-619e229c9777f0ee0851d8c5c94caaad7d89d434.tar.gz external_python_setuptools-619e229c9777f0ee0851d8c5c94caaad7d89d434.tar.bz2 external_python_setuptools-619e229c9777f0ee0851d8c5c94caaad7d89d434.zip |
Merge branch 'master' into docs/setup.cfg-only
Diffstat (limited to 'setuptools/tests/test_setuptools.py')
-rw-r--r-- | setuptools/tests/test_setuptools.py | 88 |
1 files changed, 6 insertions, 82 deletions
diff --git a/setuptools/tests/test_setuptools.py b/setuptools/tests/test_setuptools.py index 5896a69a..08d263ae 100644 --- a/setuptools/tests/test_setuptools.py +++ b/setuptools/tests/test_setuptools.py @@ -4,7 +4,7 @@ import sys import os import distutils.core import distutils.cmd -from distutils.errors import DistutilsOptionError, DistutilsPlatformError +from distutils.errors import DistutilsOptionError from distutils.errors import DistutilsSetupError from distutils.core import Extension from distutils.version import LooseVersion @@ -14,7 +14,6 @@ import pytest import setuptools import setuptools.dist import setuptools.depends as dep -from setuptools import Feature from setuptools.depends import Require from setuptools.extern import six @@ -108,6 +107,11 @@ class TestDepends: assert not req.is_present() assert not req.is_current() + @needs_bytecode + def test_require_present(self): + # In #1896, this test was failing for months with the only + # complaint coming from test runners (not end users). + # TODO: Evaluate if this code is needed at all. req = Require('Tests', None, 'tests', homepage="http://example.com") assert req.format is None assert req.attribute is None @@ -211,86 +215,6 @@ class TestDistro: self.dist.exclude(package_dir=['q']) -@pytest.mark.filterwarnings('ignore:Features are deprecated') -class TestFeatures: - def setup_method(self, method): - self.req = Require('Distutils', '1.0.3', 'distutils') - self.dist = makeSetup( - features={ - 'foo': Feature( - "foo", standard=True, require_features=['baz', self.req]), - 'bar': Feature("bar", standard=True, packages=['pkg.bar'], - py_modules=['bar_et'], remove=['bar.ext'], - ), - 'baz': Feature( - "baz", optional=False, packages=['pkg.baz'], - scripts=['scripts/baz_it'], - libraries=[('libfoo', 'foo/foofoo.c')] - ), - 'dwim': Feature("DWIM", available=False, remove='bazish'), - }, - script_args=['--without-bar', 'install'], - packages=['pkg.bar', 'pkg.foo'], - py_modules=['bar_et', 'bazish'], - ext_modules=[Extension('bar.ext', ['bar.c'])] - ) - - def testDefaults(self): - assert not Feature( - "test", standard=True, remove='x', available=False - ).include_by_default() - assert Feature("test", standard=True, remove='x').include_by_default() - # Feature must have either kwargs, removes, or require_features - with pytest.raises(DistutilsSetupError): - Feature("test") - - def testAvailability(self): - with pytest.raises(DistutilsPlatformError): - self.dist.features['dwim'].include_in(self.dist) - - def testFeatureOptions(self): - dist = self.dist - assert ( - ('with-dwim', None, 'include DWIM') in dist.feature_options - ) - assert ( - ('without-dwim', None, 'exclude DWIM (default)') - in dist.feature_options - ) - assert ( - ('with-bar', None, 'include bar (default)') in dist.feature_options - ) - assert ( - ('without-bar', None, 'exclude bar') in dist.feature_options - ) - assert dist.feature_negopt['without-foo'] == 'with-foo' - assert dist.feature_negopt['without-bar'] == 'with-bar' - assert dist.feature_negopt['without-dwim'] == 'with-dwim' - assert ('without-baz' not in dist.feature_negopt) - - def testUseFeatures(self): - dist = self.dist - assert dist.with_foo == 1 - assert dist.with_bar == 0 - assert dist.with_baz == 1 - assert ('bar_et' not in dist.py_modules) - assert ('pkg.bar' not in dist.packages) - assert ('pkg.baz' in dist.packages) - assert ('scripts/baz_it' in dist.scripts) - assert (('libfoo', 'foo/foofoo.c') in dist.libraries) - assert dist.ext_modules == [] - assert dist.require_features == [self.req] - - # If we ask for bar, it should fail because we explicitly disabled - # it on the command line - with pytest.raises(DistutilsOptionError): - dist.include_feature('bar') - - def testFeatureWithInvalidRemove(self): - with pytest.raises(SystemExit): - makeSetup(features={'x': Feature('x', remove='y')}) - - class TestCommandTests: def testTestIsCommand(self): test_cmd = makeSetup().get_command_obj('test') |