summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.cfg4
-rw-r--r--tox.ini3
-rw-r--r--ttrun/cmd.py48
3 files changed, 52 insertions, 3 deletions
diff --git a/setup.cfg b/setup.cfg
index 483e178..fe41412 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -20,3 +20,7 @@ classifier =
20[files] 20[files]
21packages = 21packages =
22 ttrun 22 ttrun
23
24[entry_points]
25console_scripts =
26 ttrun = ttrun.cmd:main
diff --git a/tox.ini b/tox.ini
index ecd1bd3..3cf0182 100644
--- a/tox.ini
+++ b/tox.ini
@@ -22,9 +22,6 @@ commands = {posargs}
22commands = python setup.py test --coverage --testr-args='{posargs}' 22commands = python setup.py test --coverage --testr-args='{posargs}'
23 23
24[flake8] 24[flake8]
25# E123, E125 skipped as they are invalid PEP-8.
26
27show-source = True 25show-source = True
28ignore = E123,E125
29builtins = _ 26builtins = _
30exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build 27exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
diff --git a/ttrun/cmd.py b/ttrun/cmd.py
new file mode 100644
index 0000000..a237b1b
--- /dev/null
+++ b/ttrun/cmd.py
@@ -0,0 +1,48 @@
1# Copyright (c) 2016 Red Hat, Inc
2#
3# This file is part of ttrun
4#
5# ttrun is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# ttrun is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
17
18import argparse
19import subprocess
20import sys
21
22import testtools
23
24
25def parse_arguments():
26 parser = argparse.ArgumentParser(
27 description='Simple CLI to run tests with testtools')
28 parser.add_argument(
29 '-e', dest='environment', help='tox environment to use')
30 parser.add_argument('tests', nargs='*', help='Tests to run')
31 return parser.parse_args()
32
33
34def main():
35 args = parse_arguments()
36
37 if args.environment:
38 return subprocess.call([
39 '.tox/{environment}/bin/python'.format(
40 environment=args.environment),
41 '-m',
42 'testtools.run'] + args.tests)
43 else:
44 return testtools.run.main([sys.argv[0]] + args.tests, sys.stdout)
45
46
47if __name__ == '__main__':
48 sys.exit(main())