def testRequire(self): req = Require('Json', '1.0.3', 'json') assert req.name == 'Json' assert req.module == 'json' assert req.requested_version == '1.0.3' assert req.attribute == '__version__' assert req.full_name() == 'Json-1.0.3' from json import __version__ assert req.get_version() == __version__ assert req.version_ok('1.0.9') assert not req.version_ok('0.9.1') assert not req.version_ok('unknown') assert req.is_present() assert req.is_current() req = Require('Json 3000', '03000', 'json', format=LooseVersion) assert req.is_present() assert not req.is_current() assert not req.version_ok('unknown') req = Require('Do-what-I-mean', '1.0', 'd-w-i-m') assert not req.is_present() assert not req.is_current()
def testRequire(self): if not hasattr(dep, 'extract_constant'): # skip on non-bytecode platformsh return req = Require('Email', '1.0.3', 'email') self.assertEqual(req.name, 'Email') self.assertEqual(req.module, 'email') self.assertEqual(req.requested_version, '1.0.3') self.assertEqual(req.attribute, '__version__') self.assertEqual(req.full_name(), 'Email-1.0.3') from email import __version__ self.assertEqual(req.get_version(), __version__) self.assertTrue(req.version_ok('1.0.9')) self.assertTrue(not req.version_ok('0.9.1')) self.assertTrue(not req.version_ok('unknown')) self.assertTrue(req.is_present()) self.assertTrue(req.is_current()) req = Require('Email 3000', '03000', 'email', format=LooseVersion) self.assertTrue(req.is_present()) self.assertTrue(not req.is_current()) self.assertTrue(not req.version_ok('unknown')) req = Require('Do-what-I-mean', '1.0', 'd-w-i-m') self.assertTrue(not req.is_present()) self.assertTrue(not req.is_current()) req = Require('Tests', None, 'tests', homepage="http://example.com") self.assertEqual(req.format, None) self.assertEqual(req.attribute, None) self.assertEqual(req.requested_version, None) self.assertEqual(req.full_name(), 'Tests') self.assertEqual(req.homepage, 'http://example.com') paths = [os.path.dirname(p) for p in __path__] self.assertTrue(req.is_present(paths)) self.assertTrue(req.is_current(paths))
def testRequire(self): req = Require('Distutils', '1.0.3', 'distutils') self.assertEqual(req.name, 'Distutils') self.assertEqual(req.module, 'distutils') self.assertEqual(req.requested_version, '1.0.3') self.assertEqual(req.attribute, '__version__') self.assertEqual(req.full_name(), 'Distutils-1.0.3') from distutils import __version__ self.assertEqual(req.get_version(), __version__) self.failUnless(req.version_ok('1.0.9')) self.failIf(req.version_ok('0.9.1')) self.failIf(req.version_ok('unknown')) self.failUnless(req.is_present()) self.failUnless(req.is_current()) req = Require('Distutils 3000', '03000', 'distutils', format=LooseVersion) self.failUnless(req.is_present()) self.failIf(req.is_current()) self.failIf(req.version_ok('unknown')) req = Require('Do-what-I-mean', '1.0', 'd-w-i-m') self.failIf(req.is_present()) self.failIf(req.is_current()) req = Require('Tests', None, 'tests', homepage="http://example.com") self.assertEqual(req.format, None) self.assertEqual(req.attribute, None) self.assertEqual(req.requested_version, None) self.assertEqual(req.full_name(), 'Tests') self.assertEqual(req.homepage, 'http://example.com') paths = [os.path.dirname(p) for p in __path__] self.failUnless(req.is_present(paths)) self.failUnless(req.is_current(paths))
def testRequire(self): if not extract_constant: return # skip on non-bytecode platforms req = Require("Email", "1.0.3", "email") self.assertEqual(req.name, "Email") self.assertEqual(req.module, "email") self.assertEqual(req.requested_version, "1.0.3") self.assertEqual(req.attribute, "__version__") self.assertEqual(req.full_name(), "Email-1.0.3") from email import __version__ self.assertEqual(req.get_version(), __version__) self.assert_(req.version_ok("1.0.9")) self.assert_(not req.version_ok("0.9.1")) self.assert_(not req.version_ok("unknown")) self.assert_(req.is_present()) self.assert_(req.is_current()) req = Require("Email 3000", "03000", "email", format=LooseVersion) self.assert_(req.is_present()) self.assert_(not req.is_current()) self.assert_(not req.version_ok("unknown")) req = Require("Do-what-I-mean", "1.0", "d-w-i-m") self.assert_(not req.is_present()) self.assert_(not req.is_current()) req = Require("Tests", None, "tests", homepage="http://example.com") self.assertEqual(req.format, None) self.assertEqual(req.attribute, None) self.assertEqual(req.requested_version, None) self.assertEqual(req.full_name(), "Tests") self.assertEqual(req.homepage, "http://example.com") paths = [os.path.dirname(p) for p in __path__] self.assert_(req.is_present(paths)) self.assert_(req.is_current(paths))
def testRequire(self): req = Require('Json', '1.0.3', 'json') assert req.name == 'Json' assert req.module == 'json' assert req.requested_version == '1.0.3' assert req.attribute == '__version__' assert req.full_name() == 'Json-1.0.3' from json import __version__ assert req.get_version() == __version__ assert req.version_ok('1.0.9') assert not req.version_ok('0.9.1') assert not req.version_ok('unknown') assert req.is_present() assert req.is_current() req = Require('Json 3000', '03000', 'json', format=LooseVersion) assert req.is_present() assert not req.is_current() assert not req.version_ok('unknown') req = Require('Do-what-I-mean', '1.0', 'd-w-i-m') assert not req.is_present() assert not req.is_current() req = Require('Tests', None, 'tests', homepage="http://example.com") assert req.format is None assert req.attribute is None assert req.requested_version is None assert req.full_name() == 'Tests' assert req.homepage == 'http://example.com' from setuptools.tests import __path__ paths = [os.path.dirname(p) for p in __path__] assert req.is_present(paths) assert req.is_current(paths)
def testRequire(self): req = Require('Distutils','1.0.3','distutils') self.assertEqual(req.name, 'Distutils') self.assertEqual(req.module, 'distutils') self.assertEqual(req.requested_version, '1.0.3') self.assertEqual(req.attribute, '__version__') self.assertEqual(req.full_name(), 'Distutils-1.0.3') from distutils import __version__ self.assertEqual(req.get_version(), __version__) self.failUnless(req.version_ok('1.0.9')) self.failIf(req.version_ok('0.9.1')) self.failIf(req.version_ok('unknown')) self.failUnless(req.is_present()) self.failUnless(req.is_current()) req = Require('Distutils 3000','03000','distutils',format=LooseVersion) self.failUnless(req.is_present()) self.failIf(req.is_current()) self.failIf(req.version_ok('unknown')) req = Require('Do-what-I-mean','1.0','d-w-i-m') self.failIf(req.is_present()) self.failIf(req.is_current()) req = Require('Tests', None, 'tests', homepage="http://example.com") self.assertEqual(req.format, None) self.assertEqual(req.attribute, None) self.assertEqual(req.requested_version, None) self.assertEqual(req.full_name(), 'Tests') self.assertEqual(req.homepage, 'http://example.com') paths = [os.path.dirname(p) for p in __path__] self.failUnless(req.is_present(paths)) self.failUnless(req.is_current(paths))
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 assert req.requested_version is None assert req.full_name() == 'Tests' assert req.homepage == 'http://example.com' from setuptools.tests import __path__ paths = [os.path.dirname(p) for p in __path__] assert req.is_present(paths) assert req.is_current(paths)