我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用setuptools.dist.exclude()。
def testFeatureOptions(self): dist = self.dist self.assertTrue( ('with-dwim',None,'include DWIM') in dist.feature_options ) self.assertTrue( ('without-dwim',None,'exclude DWIM (default)') in dist.feature_options ) self.assertTrue( ('with-bar',None,'include bar (default)') in dist.feature_options ) self.assertTrue( ('without-bar',None,'exclude bar') in dist.feature_options ) self.assertEqual(dist.feature_negopt['without-foo'],'with-foo') self.assertEqual(dist.feature_negopt['without-bar'],'with-bar') self.assertEqual(dist.feature_negopt['without-dwim'],'with-dwim') self.assertTrue(not 'without-baz' in dist.feature_negopt)
def testInvalidIncludeExclude(self): with pytest.raises(DistutilsSetupError): self.dist.include(nonexistent_option='x') with pytest.raises(DistutilsSetupError): self.dist.exclude(nonexistent_option='x') with pytest.raises(DistutilsSetupError): self.dist.include(packages={'x':'y'}) with pytest.raises(DistutilsSetupError): self.dist.exclude(packages={'x':'y'}) with pytest.raises(DistutilsSetupError): self.dist.include(ext_modules={'x':'y'}) with pytest.raises(DistutilsSetupError): self.dist.exclude(ext_modules={'x':'y'}) with pytest.raises(DistutilsSetupError): self.dist.include(package_dir=['q']) with pytest.raises(DistutilsSetupError): self.dist.exclude(package_dir=['q'])
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 (not 'without-baz' in dist.feature_negopt)
def testInvalidIncludeExclude(self): with pytest.raises(DistutilsSetupError): self.dist.include(nonexistent_option='x') with pytest.raises(DistutilsSetupError): self.dist.exclude(nonexistent_option='x') with pytest.raises(DistutilsSetupError): self.dist.include(packages={'x': 'y'}) with pytest.raises(DistutilsSetupError): self.dist.exclude(packages={'x': 'y'}) with pytest.raises(DistutilsSetupError): self.dist.include(ext_modules={'x': 'y'}) with pytest.raises(DistutilsSetupError): self.dist.exclude(ext_modules={'x': 'y'}) with pytest.raises(DistutilsSetupError): self.dist.include(package_dir=['q']) with pytest.raises(DistutilsSetupError): self.dist.exclude(package_dir=['q'])
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 testIncludeExclude(self): # remove an extension self.dist.exclude(ext_modules=[self.e1]) self.assertEqual(self.dist.ext_modules, [self.e2]) # add it back in self.dist.include(ext_modules=[self.e1]) self.assertEqual(self.dist.ext_modules, [self.e2, self.e1]) # should not add duplicate self.dist.include(ext_modules=[self.e1]) self.assertEqual(self.dist.ext_modules, [self.e2, self.e1])
def testExcludePackages(self): self.dist.exclude(packages=['c','b','a']) self.assertEqual(self.dist.packages, []) self.assertEqual(self.dist.py_modules, ['x']) self.assertEqual(self.dist.ext_modules, [self.e1])
def testEmpty(self): dist = makeSetup() dist.include(packages=['a'], py_modules=['b'], ext_modules=[self.e2]) dist = makeSetup() dist.exclude(packages=['a'], py_modules=['b'], ext_modules=[self.e2])
def testInvalidIncludeExclude(self): self.assertRaises(DistutilsSetupError, self.dist.include, nonexistent_option='x' ) self.assertRaises(DistutilsSetupError, self.dist.exclude, nonexistent_option='x' ) self.assertRaises(DistutilsSetupError, self.dist.include, packages={'x':'y'} ) self.assertRaises(DistutilsSetupError, self.dist.exclude, packages={'x':'y'} ) self.assertRaises(DistutilsSetupError, self.dist.include, ext_modules={'x':'y'} ) self.assertRaises(DistutilsSetupError, self.dist.exclude, ext_modules={'x':'y'} ) self.assertRaises(DistutilsSetupError, self.dist.include, package_dir=['q'] ) self.assertRaises(DistutilsSetupError, self.dist.exclude, package_dir=['q'] )
def testIncludeExclude(self): # remove an extension self.dist.exclude(ext_modules=[self.e1]) assert self.dist.ext_modules == [self.e2] # add it back in self.dist.include(ext_modules=[self.e1]) assert self.dist.ext_modules == [self.e2, self.e1] # should not add duplicate self.dist.include(ext_modules=[self.e1]) assert self.dist.ext_modules == [self.e2, self.e1]