* [gentoo-commits] proj/gentoolkit:master commit in: /, pym/gentoolkit/test/
@ 2018-08-14 16:01 Virgil Dupras
0 siblings, 0 replies; only message in thread
From: Virgil Dupras @ 2018-08-14 16:01 UTC (permalink / raw
To: gentoo-commits
commit: 31706fd222edc7e75cb051012dab644e88537ea9
Author: Virgil Dupras <hsoft <AT> hardcoded <DOT> net>
AuthorDate: Tue Aug 14 13:09:13 2018 +0000
Commit: Virgil Dupras <vdupras <AT> gentoo <DOT> org>
CommitDate: Tue Aug 14 13:09:13 2018 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=31706fd2
Fix broken test suite
The test suite (python setup.py test) was depending on a broken
interface from dev-python/snakeoil. This indicates that tests weren't
run in a while.
We don't actually need snakeoil to run tests. Replaced the test command
with a plain distutils Command.
Moreover, one of test Query tests wasn't in sync with the code. Changed
it to reflect current code.
pym/gentoolkit/test/test_query.py | 8 ++------
setup.py | 36 +++++++++++++++---------------------
2 files changed, 17 insertions(+), 27 deletions(-)
diff --git a/pym/gentoolkit/test/test_query.py b/pym/gentoolkit/test/test_query.py
index 1513b5b..24880de 100644
--- a/pym/gentoolkit/test/test_query.py
+++ b/pym/gentoolkit/test/test_query.py
@@ -1,6 +1,4 @@
import unittest
-import warnings
-from tempfile import NamedTemporaryFile, mktemp
from gentoolkit import query
from gentoolkit import errors
@@ -15,13 +13,11 @@ class TestQuery(unittest.TestCase):
pass
def test_init(self):
- # valid queries must have at least one ascii letter or '*'
+ # valid queries must have at least one ascii letter or digit or
+ # '*'
invalid_queries = [
'',
- '1',
'/',
- '-1',
- '1/1',
]
for q in invalid_queries:
self.failUnlessRaises(errors.GentoolkitInvalidPackage,
diff --git a/setup.py b/setup.py
index 7d170e2..031afd3 100755
--- a/setup.py
+++ b/setup.py
@@ -5,8 +5,9 @@ from __future__ import print_function
import re
import sys
-import distutils
-from distutils import core #, log
+import subprocess
+from distutils import core
+from distutils.cmd import Command
from glob import glob
import os
@@ -98,26 +99,19 @@ class set_version(core.Command):
sub(manpages, man_re)
-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 = 'gentoolkit.test'
- else:
- class test(core.Command):
- description = desc
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ args = [sys.executable, '-m', 'unittest', 'discover', 'pym']
+ raise SystemExit(subprocess.call(args))
- return test
packages = [
str('.'.join(root.split(os.sep)[1:]))
@@ -156,7 +150,7 @@ core.setup(
(os.path.join(os.sep, EPREFIX.lstrip(os.sep), 'usr/lib/tmpfiles.d'), ['data/tmpfiles.d/revdep-rebuild.conf']),
),
cmdclass={
- 'test': load_test(),
+ 'test': TestCommand,
'set_version': set_version,
},
)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-08-14 16:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-14 16:01 [gentoo-commits] proj/gentoolkit:master commit in: /, pym/gentoolkit/test/ Virgil Dupras
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox