diff options
author | Zac Medico <zmedico@gentoo.org> | 2019-05-26 23:11:28 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2019-05-27 00:39:39 -0700 |
commit | 42238f4ff13ae6c75bc1925f366429a35c26317d (patch) | |
tree | 5ae1854a94b0bc6280f7d4cef5cbf93414247c5c /setup.py | |
parent | Update version for 2.2.4 release (diff) | |
download | mirrorselect-42238f4ff13ae6c75bc1925f366429a35c26317d.tar.gz mirrorselect-42238f4ff13ae6c75bc1925f366429a35c26317d.tar.bz2 mirrorselect-42238f4ff13ae6c75bc1925f366429a35c26317d.zip |
write_make_conf: support multi-line GENTOO_MIRRORS (bug 543814)
Use shlex to support multi-line GENTOO_MIRRORS assignments.
Bug: https://bugs.gentoo.org/543814
Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 37 |
1 files changed, 18 insertions, 19 deletions
@@ -8,9 +8,11 @@ import re import sys from distutils import core, log from distutils.command.sdist import sdist +from distutils.core import Command import os import io +import unittest __version__ = os.getenv('VERSION', default=os.getenv('PVR', default='9999')) @@ -80,26 +82,23 @@ class x_sdist(sdist): sdist.finalize_options(self) -def load_test(): - """Only return the real test class if it's actually being run so that we - don't depend on snakeoil just to install.""" +class TestCommand(Command): + user_options = [] - desc = "run the test suite" - if 'test' in sys.argv[1:]: - try: - from snakeoil import distutils_extensions - except ImportError: - sys.stderr.write("Error: We depend on dev-python/snakeoil ") - sys.stderr.write("to run tests.\n") - sys.exit(1) - class test(distutils_extensions.test): - description = desc - default_test_namespace = 'mirrorselect.test' - else: - class test(core.Command): - description = desc + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + suite = unittest.TestSuite() + tests = unittest.defaultTestLoader.discover('tests') + suite.addTests(tests) + result = unittest.TextTestRunner(verbosity=2).run(suite) + if result.errors or result.failures: + raise SystemExit(1) - return test test_data = { 'mirrorselect': [ @@ -125,7 +124,7 @@ core.setup( ['mirrorselect.8']), ), cmdclass={ - 'test': load_test(), + 'test': TestCommand, 'sdist': x_sdist, 'set_version': set_version, }, |