/distutils2/_backport/tests/test_pkgutil.py

https://bitbucket.org/tarek/distutils2/
Python | 608 lines | 419 code | 116 blank | 73 comment | 76 complexity | a5b5573268c531f7ab76fd0467389e28 MD5 | raw file

✨ Summary
  1. # -*- coding: utf-8 -*-
  2. """Tests for PEP 376 pkgutil functionality"""
  3. import imp
  4. import sys
  5. import csv
  6. import os
  7. import shutil
  8. import tempfile
  9. import zipfile
  10. try:
  11. from hashlib import md5
  12. except ImportError:
  13. from distutils2._backport.hashlib import md5
  14. from distutils2.errors import DistutilsError
  15. from distutils2.metadata import Metadata
  16. from distutils2.tests import unittest, run_unittest, support, TESTFN
  17. from distutils2._backport import pkgutil
  18. from distutils2._backport.pkgutil import (
  19. Distribution, EggInfoDistribution, get_distribution, get_distributions,
  20. provides_distribution, obsoletes_distribution, get_file_users,
  21. distinfo_dirname, _yield_distributions)
  22. try:
  23. from os.path import relpath
  24. except ImportError:
  25. try:
  26. from unittest.compatibility import relpath
  27. except ImportError:
  28. from unittest2.compatibility import relpath
  29. # Adapted from Python 2.7's trunk
  30. # TODO Add a test for getting a distribution that is provided by another
  31. # distribution.
  32. # TODO Add a test for absolute pathed RECORD items (e.g. /etc/myapp/config.ini)
  33. class TestPkgUtilData(unittest.TestCase):
  34. def setUp(self):
  35. super(TestPkgUtilData, self).setUp()
  36. self.dirname = tempfile.mkdtemp()
  37. sys.path.insert(0, self.dirname)
  38. pkgutil.disable_cache()
  39. def tearDown(self):
  40. super(TestPkgUtilData, self).tearDown()
  41. del sys.path[0]
  42. pkgutil.enable_cache()
  43. shutil.rmtree(self.dirname)
  44. def test_getdata_filesys(self):
  45. pkg = 'test_getdata_filesys'
  46. # Include a LF and a CRLF, to test that binary data is read back
  47. RESOURCE_DATA = 'Hello, world!\nSecond line\r\nThird line'
  48. # Make a package with some resources
  49. package_dir = os.path.join(self.dirname, pkg)
  50. os.mkdir(package_dir)
  51. # Empty init.py
  52. f = open(os.path.join(package_dir, '__init__.py'), "wb")
  53. try:
  54. pass
  55. finally:
  56. f.close()
  57. # Resource files, res.txt, sub/res.txt
  58. f = open(os.path.join(package_dir, 'res.txt'), "wb")
  59. try:
  60. f.write(RESOURCE_DATA)
  61. finally:
  62. f.close()
  63. os.mkdir(os.path.join(package_dir, 'sub'))
  64. f = open(os.path.join(package_dir, 'sub', 'res.txt'), "wb")
  65. try:
  66. f.write(RESOURCE_DATA)
  67. finally:
  68. f.close()
  69. # Check we can read the resources
  70. res1 = pkgutil.get_data(pkg, 'res.txt')
  71. self.assertEqual(res1, RESOURCE_DATA)
  72. res2 = pkgutil.get_data(pkg, 'sub/res.txt')
  73. self.assertEqual(res2, RESOURCE_DATA)
  74. del sys.modules[pkg]
  75. def test_getdata_zipfile(self):
  76. zip = 'test_getdata_zipfile.zip'
  77. pkg = 'test_getdata_zipfile'
  78. # Include a LF and a CRLF, to test that binary data is read back
  79. RESOURCE_DATA = 'Hello, world!\nSecond line\r\nThird line'
  80. # Make a package with some resources
  81. zip_file = os.path.join(self.dirname, zip)
  82. z = zipfile.ZipFile(zip_file, 'w')
  83. try:
  84. # Empty init.py
  85. z.writestr(pkg + '/__init__.py', "")
  86. # Resource files, res.txt, sub/res.txt
  87. z.writestr(pkg + '/res.txt', RESOURCE_DATA)
  88. z.writestr(pkg + '/sub/res.txt', RESOURCE_DATA)
  89. finally:
  90. z.close()
  91. # Check we can read the resources
  92. sys.path.insert(0, zip_file)
  93. res1 = pkgutil.get_data(pkg, 'res.txt')
  94. self.assertEqual(res1, RESOURCE_DATA)
  95. res2 = pkgutil.get_data(pkg, 'sub/res.txt')
  96. self.assertEqual(res2, RESOURCE_DATA)
  97. names = []
  98. for loader, name, ispkg in pkgutil.iter_modules([zip_file]):
  99. names.append(name)
  100. self.assertEqual(names, ['test_getdata_zipfile'])
  101. del sys.path[0]
  102. del sys.modules[pkg]
  103. # Adapted from Python 2.7's trunk
  104. class TestPkgUtilPEP302(unittest.TestCase):
  105. class MyTestLoader(object):
  106. def load_module(self, fullname):
  107. # Create an empty module
  108. mod = sys.modules.setdefault(fullname, imp.new_module(fullname))
  109. mod.__file__ = "<%s>" % self.__class__.__name__
  110. mod.__loader__ = self
  111. # Make it a package
  112. mod.__path__ = []
  113. # Count how many times the module is reloaded
  114. mod.__dict__['loads'] = mod.__dict__.get('loads', 0) + 1
  115. return mod
  116. def get_data(self, path):
  117. return "Hello, world!"
  118. class MyTestImporter(object):
  119. def find_module(self, fullname, path=None):
  120. return TestPkgUtilPEP302.MyTestLoader()
  121. def setUp(self):
  122. super(TestPkgUtilPEP302, self).setUp()
  123. pkgutil.disable_cache()
  124. sys.meta_path.insert(0, self.MyTestImporter())
  125. def tearDown(self):
  126. del sys.meta_path[0]
  127. pkgutil.enable_cache()
  128. super(TestPkgUtilPEP302, self).tearDown()
  129. def test_getdata_pep302(self):
  130. # Use a dummy importer/loader
  131. self.assertEqual(pkgutil.get_data('foo', 'dummy'), "Hello, world!")
  132. del sys.modules['foo']
  133. def test_alreadyloaded(self):
  134. # Ensure that get_data works without reloading - the "loads" module
  135. # variable in the example loader should count how many times a reload
  136. # occurs.
  137. import foo
  138. self.assertEqual(foo.loads, 1)
  139. self.assertEqual(pkgutil.get_data('foo', 'dummy'), "Hello, world!")
  140. self.assertEqual(foo.loads, 1)
  141. del sys.modules['foo']
  142. class TestPkgUtilDistribution(unittest.TestCase):
  143. # Tests the pkgutil.Distribution class
  144. def setUp(self):
  145. super(TestPkgUtilDistribution, self).setUp()
  146. self.fake_dists_path = os.path.abspath(
  147. os.path.join(os.path.dirname(__file__), 'fake_dists'))
  148. pkgutil.disable_cache()
  149. self.distinfo_dirs = [os.path.join(self.fake_dists_path, dir)
  150. for dir in os.listdir(self.fake_dists_path)
  151. if dir.endswith('.dist-info')]
  152. def get_hexdigest(file):
  153. md5_hash = md5()
  154. md5_hash.update(open(file).read())
  155. return md5_hash.hexdigest()
  156. def record_pieces(file):
  157. path = relpath(file, sys.prefix)
  158. digest = get_hexdigest(file)
  159. size = os.path.getsize(file)
  160. return [path, digest, size]
  161. self.records = {}
  162. for distinfo_dir in self.distinfo_dirs:
  163. # Setup the RECORD file for this dist
  164. record_file = os.path.join(distinfo_dir, 'RECORD')
  165. record_writer = csv.writer(open(record_file, 'w'), delimiter=',',
  166. quoting=csv.QUOTE_NONE)
  167. dist_location = distinfo_dir.replace('.dist-info', '')
  168. for path, dirs, files in os.walk(dist_location):
  169. for f in files:
  170. record_writer.writerow(record_pieces(
  171. os.path.join(path, f)))
  172. for file in ['INSTALLER', 'METADATA', 'REQUESTED']:
  173. record_writer.writerow(record_pieces(
  174. os.path.join(distinfo_dir, file)))
  175. record_writer.writerow([relpath(record_file, sys.prefix)])
  176. del record_writer # causes the RECORD file to close
  177. record_reader = csv.reader(open(record_file, 'rb'))
  178. record_data = []
  179. for row in record_reader:
  180. path, md5_, size = row[:] + \
  181. [None for i in xrange(len(row), 3)]
  182. record_data.append([path, (md5_, size, )])
  183. self.records[distinfo_dir] = dict(record_data)
  184. def tearDown(self):
  185. self.records = None
  186. for distinfo_dir in self.distinfo_dirs:
  187. record_file = os.path.join(distinfo_dir, 'RECORD')
  188. open(record_file, 'w').close()
  189. pkgutil.enable_cache()
  190. super(TestPkgUtilDistribution, self).tearDown()
  191. def test_instantiation(self):
  192. # Test the Distribution class's instantiation provides us with usable
  193. # attributes.
  194. here = os.path.abspath(os.path.dirname(__file__))
  195. name = 'choxie'
  196. version = '2.0.0.9'
  197. dist_path = os.path.join(here, 'fake_dists',
  198. distinfo_dirname(name, version))
  199. dist = Distribution(dist_path)
  200. self.assertEqual(dist.name, name)
  201. self.assertTrue(isinstance(dist.metadata, Metadata))
  202. self.assertEqual(dist.metadata['version'], version)
  203. self.assertTrue(isinstance(dist.requested, type(bool())))
  204. def test_installed_files(self):
  205. # Test the iteration of installed files.
  206. # Test the distribution's installed files
  207. for distinfo_dir in self.distinfo_dirs:
  208. dist = Distribution(distinfo_dir)
  209. for path, md5_, size in dist.get_installed_files():
  210. record_data = self.records[dist.path]
  211. self.assertIn(path, record_data)
  212. self.assertEqual(md5_, record_data[path][0])
  213. self.assertEqual(size, record_data[path][1])
  214. def test_uses(self):
  215. # Test to determine if a distribution uses a specified file.
  216. # Criteria to test against
  217. distinfo_name = 'grammar-1.0a4'
  218. distinfo_dir = os.path.join(self.fake_dists_path,
  219. distinfo_name + '.dist-info')
  220. true_path = [self.fake_dists_path, distinfo_name, \
  221. 'grammar', 'utils.py']
  222. true_path = relpath(os.path.join(*true_path), sys.prefix)
  223. false_path = [self.fake_dists_path, 'towel_stuff-0.1', 'towel_stuff',
  224. '__init__.py']
  225. false_path = relpath(os.path.join(*false_path), sys.prefix)
  226. # Test if the distribution uses the file in question
  227. dist = Distribution(distinfo_dir)
  228. self.assertTrue(dist.uses(true_path))
  229. self.assertFalse(dist.uses(false_path))
  230. def test_get_distinfo_file(self):
  231. # Test the retrieval of dist-info file objects.
  232. distinfo_name = 'choxie-2.0.0.9'
  233. other_distinfo_name = 'grammar-1.0a4'
  234. distinfo_dir = os.path.join(self.fake_dists_path,
  235. distinfo_name + '.dist-info')
  236. dist = Distribution(distinfo_dir)
  237. # Test for known good file matches
  238. distinfo_files = [
  239. # Relative paths
  240. 'INSTALLER', 'METADATA',
  241. # Absolute paths
  242. os.path.join(distinfo_dir, 'RECORD'),
  243. os.path.join(distinfo_dir, 'REQUESTED'),
  244. ]
  245. for distfile in distinfo_files:
  246. value = dist.get_distinfo_file(distfile)
  247. self.assertTrue(isinstance(value, file))
  248. # Is it the correct file?
  249. self.assertEqual(value.name, os.path.join(distinfo_dir, distfile))
  250. # Test an absolute path that is part of another distributions dist-info
  251. other_distinfo_file = os.path.join(self.fake_dists_path,
  252. other_distinfo_name + '.dist-info', 'REQUESTED')
  253. self.assertRaises(DistutilsError, dist.get_distinfo_file,
  254. other_distinfo_file)
  255. # Test for a file that does not exist and should not exist
  256. self.assertRaises(DistutilsError, dist.get_distinfo_file, \
  257. 'ENTRYPOINTS')
  258. def test_get_distinfo_files(self):
  259. # Test for the iteration of RECORD path entries.
  260. distinfo_name = 'towel_stuff-0.1'
  261. distinfo_dir = os.path.join(self.fake_dists_path,
  262. distinfo_name + '.dist-info')
  263. dist = Distribution(distinfo_dir)
  264. # Test for the iteration of the raw path
  265. distinfo_record_paths = self.records[distinfo_dir].keys()
  266. found = [path for path in dist.get_distinfo_files()]
  267. self.assertEqual(sorted(found), sorted(distinfo_record_paths))
  268. # Test for the iteration of local absolute paths
  269. distinfo_record_paths = [os.path.join(sys.prefix, path)
  270. for path in self.records[distinfo_dir]]
  271. found = [path for path in dist.get_distinfo_files(local=True)]
  272. self.assertEqual(sorted(found), sorted(distinfo_record_paths))
  273. def test_get_resources_path(self):
  274. distinfo_name = 'babar-0.1'
  275. distinfo_dir = os.path.join(self.fake_dists_path,
  276. distinfo_name + '.dist-info')
  277. dist = Distribution(distinfo_dir)
  278. resource_path = dist.get_resource_path('babar.png')
  279. self.assertEqual(resource_path, 'babar.png')
  280. self.assertRaises(KeyError, dist.get_resource_path, 'notexist')
  281. class TestPkgUtilPEP376(support.LoggingCatcher, support.WarningsCatcher,
  282. unittest.TestCase):
  283. # Tests for the new functionality added in PEP 376.
  284. def setUp(self):
  285. super(TestPkgUtilPEP376, self).setUp()
  286. pkgutil.disable_cache()
  287. # Setup the path environment with our fake distributions
  288. current_path = os.path.abspath(os.path.dirname(__file__))
  289. self.sys_path = sys.path[:]
  290. self.fake_dists_path = os.path.join(current_path, 'fake_dists')
  291. sys.path.insert(0, self.fake_dists_path)
  292. def tearDown(self):
  293. sys.path[:] = self.sys_path
  294. pkgutil.enable_cache()
  295. super(TestPkgUtilPEP376, self).tearDown()
  296. def test_distinfo_dirname(self):
  297. # Given a name and a version, we expect the distinfo_dirname function
  298. # to return a standard distribution information directory name.
  299. items = [# (name, version, standard_dirname)
  300. # Test for a very simple single word name and decimal
  301. # version number
  302. ('docutils', '0.5', 'docutils-0.5.dist-info'),
  303. # Test for another except this time with a '-' in the name, which
  304. # needs to be transformed during the name lookup
  305. ('python-ldap', '2.5', 'python_ldap-2.5.dist-info'),
  306. # Test for both '-' in the name and a funky version number
  307. ('python-ldap', '2.5 a---5', 'python_ldap-2.5 a---5.dist-info'),
  308. ]
  309. # Loop through the items to validate the results
  310. for name, version, standard_dirname in items:
  311. dirname = distinfo_dirname(name, version)
  312. self.assertEqual(dirname, standard_dirname)
  313. def test_get_distributions(self):
  314. # Lookup all distributions found in the ``sys.path``.
  315. # This test could potentially pick up other installed distributions
  316. fake_dists = [('grammar', '1.0a4'), ('choxie', '2.0.0.9'),
  317. ('towel-stuff', '0.1'), ('babar', '0.1')]
  318. found_dists = []
  319. # Verify the fake dists have been found.
  320. dists = [dist for dist in get_distributions()]
  321. for dist in dists:
  322. if not isinstance(dist, Distribution):
  323. self.fail("item received was not a Distribution instance: "
  324. "%s" % type(dist))
  325. if dist.name in dict(fake_dists) and \
  326. dist.path.startswith(self.fake_dists_path):
  327. found_dists.append((dist.name, dist.metadata['version'], ))
  328. else:
  329. # check that it doesn't find anything more than this
  330. self.assertFalse(dist.path.startswith(self.fake_dists_path))
  331. # otherwise we don't care what other distributions are found
  332. # Finally, test that we found all that we were looking for
  333. self.assertListEqual(sorted(found_dists), sorted(fake_dists))
  334. # Now, test if the egg-info distributions are found correctly as well
  335. fake_dists += [('bacon', '0.1'), ('cheese', '2.0.2'),
  336. ('coconuts-aster', '10.3'),
  337. ('banana', '0.4'), ('strawberry', '0.6'),
  338. ('truffles', '5.0'), ('nut', 'funkyversion')]
  339. found_dists = []
  340. dists = [dist for dist in get_distributions(use_egg_info=True)]
  341. for dist in dists:
  342. if not (isinstance(dist, Distribution) or \
  343. isinstance(dist, EggInfoDistribution)):
  344. self.fail("item received was not a Distribution or "
  345. "EggInfoDistribution instance: %s" % type(dist))
  346. if dist.name in dict(fake_dists) and \
  347. dist.path.startswith(self.fake_dists_path):
  348. found_dists.append((dist.name, dist.metadata['version']))
  349. else:
  350. self.assertFalse(dist.path.startswith(self.fake_dists_path))
  351. self.assertListEqual(sorted(fake_dists), sorted(found_dists))
  352. def test_get_distribution(self):
  353. # Test for looking up a distribution by name.
  354. # Test the lookup of the towel-stuff distribution
  355. name = 'towel-stuff' # Note: This is different from the directory name
  356. # Lookup the distribution
  357. dist = get_distribution(name)
  358. self.assertTrue(isinstance(dist, Distribution))
  359. self.assertEqual(dist.name, name)
  360. # Verify that an unknown distribution returns None
  361. self.assertEqual(None, get_distribution('bogus'))
  362. # Verify partial name matching doesn't work
  363. self.assertEqual(None, get_distribution('towel'))
  364. # Verify that it does not find egg-info distributions, when not
  365. # instructed to
  366. self.assertEqual(None, get_distribution('bacon'))
  367. self.assertEqual(None, get_distribution('cheese'))
  368. self.assertEqual(None, get_distribution('strawberry'))
  369. self.assertEqual(None, get_distribution('banana'))
  370. # Now check that it works well in both situations, when egg-info
  371. # is a file and directory respectively.
  372. dist = get_distribution('cheese', use_egg_info=True)
  373. self.assertTrue(isinstance(dist, EggInfoDistribution))
  374. self.assertEqual(dist.name, 'cheese')
  375. dist = get_distribution('bacon', use_egg_info=True)
  376. self.assertTrue(isinstance(dist, EggInfoDistribution))
  377. self.assertEqual(dist.name, 'bacon')
  378. dist = get_distribution('banana', use_egg_info=True)
  379. self.assertTrue(isinstance(dist, EggInfoDistribution))
  380. self.assertEqual(dist.name, 'banana')
  381. dist = get_distribution('strawberry', use_egg_info=True)
  382. self.assertTrue(isinstance(dist, EggInfoDistribution))
  383. self.assertEqual(dist.name, 'strawberry')
  384. def test_get_file_users(self):
  385. # Test the iteration of distributions that use a file.
  386. name = 'towel_stuff-0.1'
  387. path = os.path.join(self.fake_dists_path, name,
  388. 'towel_stuff', '__init__.py')
  389. for dist in get_file_users(path):
  390. self.assertTrue(isinstance(dist, Distribution))
  391. self.assertEqual(dist.name, name)
  392. def test_provides(self):
  393. # Test for looking up distributions by what they provide
  394. checkLists = lambda x, y: self.assertListEqual(sorted(x), sorted(y))
  395. l = [dist.name for dist in provides_distribution('truffles')]
  396. checkLists(l, ['choxie', 'towel-stuff'])
  397. l = [dist.name for dist in provides_distribution('truffles', '1.0')]
  398. checkLists(l, ['choxie'])
  399. l = [dist.name for dist in provides_distribution('truffles', '1.0',
  400. use_egg_info=True)]
  401. checkLists(l, ['choxie', 'cheese'])
  402. l = [dist.name for dist in provides_distribution('truffles', '1.1.2')]
  403. checkLists(l, ['towel-stuff'])
  404. l = [dist.name for dist in provides_distribution('truffles', '1.1')]
  405. checkLists(l, ['towel-stuff'])
  406. l = [dist.name for dist in provides_distribution('truffles', \
  407. '!=1.1,<=2.0')]
  408. checkLists(l, ['choxie'])
  409. l = [dist.name for dist in provides_distribution('truffles', \
  410. '!=1.1,<=2.0',
  411. use_egg_info=True)]
  412. checkLists(l, ['choxie', 'bacon', 'cheese'])
  413. l = [dist.name for dist in provides_distribution('truffles', '>1.0')]
  414. checkLists(l, ['towel-stuff'])
  415. l = [dist.name for dist in provides_distribution('truffles', '>1.5')]
  416. checkLists(l, [])
  417. l = [dist.name for dist in provides_distribution('truffles', '>1.5',
  418. use_egg_info=True)]
  419. checkLists(l, ['bacon'])
  420. l = [dist.name for dist in provides_distribution('truffles', '>=1.0')]
  421. checkLists(l, ['choxie', 'towel-stuff'])
  422. l = [dist.name for dist in provides_distribution('strawberry', '0.6',
  423. use_egg_info=True)]
  424. checkLists(l, ['coconuts-aster'])
  425. l = [dist.name for dist in provides_distribution('strawberry', '>=0.5',
  426. use_egg_info=True)]
  427. checkLists(l, ['coconuts-aster'])
  428. l = [dist.name for dist in provides_distribution('strawberry', '>0.6',
  429. use_egg_info=True)]
  430. checkLists(l, [])
  431. l = [dist.name for dist in provides_distribution('banana', '0.4',
  432. use_egg_info=True)]
  433. checkLists(l, ['coconuts-aster'])
  434. l = [dist.name for dist in provides_distribution('banana', '>=0.3',
  435. use_egg_info=True)]
  436. checkLists(l, ['coconuts-aster'])
  437. l = [dist.name for dist in provides_distribution('banana', '!=0.4',
  438. use_egg_info=True)]
  439. checkLists(l, [])
  440. def test_obsoletes(self):
  441. # Test looking for distributions based on what they obsolete
  442. checkLists = lambda x, y: self.assertListEqual(sorted(x), sorted(y))
  443. l = [dist.name for dist in obsoletes_distribution('truffles', '1.0')]
  444. checkLists(l, [])
  445. l = [dist.name for dist in obsoletes_distribution('truffles', '1.0',
  446. use_egg_info=True)]
  447. checkLists(l, ['cheese', 'bacon'])
  448. l = [dist.name for dist in obsoletes_distribution('truffles', '0.8')]
  449. checkLists(l, ['choxie'])
  450. l = [dist.name for dist in obsoletes_distribution('truffles', '0.8',
  451. use_egg_info=True)]
  452. checkLists(l, ['choxie', 'cheese'])
  453. l = [dist.name for dist in obsoletes_distribution('truffles', '0.9.6')]
  454. checkLists(l, ['choxie', 'towel-stuff'])
  455. l = [dist.name for dist in obsoletes_distribution('truffles', \
  456. '0.5.2.3')]
  457. checkLists(l, ['choxie', 'towel-stuff'])
  458. l = [dist.name for dist in obsoletes_distribution('truffles', '0.2')]
  459. checkLists(l, ['towel-stuff'])
  460. def test_yield_distribution(self):
  461. # tests the internal function _yield_distributions
  462. checkLists = lambda x, y: self.assertListEqual(sorted(x), sorted(y))
  463. eggs = [('bacon', '0.1'), ('banana', '0.4'), ('strawberry', '0.6'),
  464. ('truffles', '5.0'), ('cheese', '2.0.2'),
  465. ('coconuts-aster', '10.3'), ('nut', 'funkyversion')]
  466. dists = [('choxie', '2.0.0.9'), ('grammar', '1.0a4'),
  467. ('towel-stuff', '0.1'), ('babar', '0.1')]
  468. checkLists([], _yield_distributions(False, False))
  469. found = [(dist.name, dist.metadata['Version'])
  470. for dist in _yield_distributions(False, True)
  471. if dist.path.startswith(self.fake_dists_path)]
  472. checkLists(eggs, found)
  473. found = [(dist.name, dist.metadata['Version'])
  474. for dist in _yield_distributions(True, False)
  475. if dist.path.startswith(self.fake_dists_path)]
  476. checkLists(dists, found)
  477. found = [(dist.name, dist.metadata['Version'])
  478. for dist in _yield_distributions(True, True)
  479. if dist.path.startswith(self.fake_dists_path)]
  480. checkLists(dists + eggs, found)
  481. def test_suite():
  482. suite = unittest.TestSuite()
  483. load = unittest.defaultTestLoader.loadTestsFromTestCase
  484. suite.addTest(load(TestPkgUtilData))
  485. suite.addTest(load(TestPkgUtilDistribution))
  486. suite.addTest(load(TestPkgUtilPEP302))
  487. suite.addTest(load(TestPkgUtilPEP376))
  488. return suite
  489. def test_main():
  490. run_unittest(test_suite())
  491. if __name__ == "__main__":
  492. test_main()