diff options
author | Monty Taylor <mordred@inaugust.com> | 2016-10-13 11:01:04 -0500 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2016-10-13 11:26:17 -0500 |
commit | 94baa515d3b63864fb0f1a5fc8f82b2c2226feb1 (patch) | |
tree | 6bd812b2ab96d1247e14251f6f1a65b9e6b7edfb | |
parent | 968571920b33dc4b5190581abe6140945b49da6d (diff) |
Add the ttrun command1.0.1
-rw-r--r-- | setup.cfg | 4 | ||||
-rw-r--r-- | tox.ini | 3 | ||||
-rw-r--r-- | ttrun/cmd.py | 48 |
3 files changed, 52 insertions, 3 deletions
@@ -20,3 +20,7 @@ classifier = | |||
20 | [files] | 20 | [files] |
21 | packages = | 21 | packages = |
22 | ttrun | 22 | ttrun |
23 | |||
24 | [entry_points] | ||
25 | console_scripts = | ||
26 | ttrun = ttrun.cmd:main | ||
@@ -22,9 +22,6 @@ commands = {posargs} | |||
22 | commands = python setup.py test --coverage --testr-args='{posargs}' | 22 | commands = 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 | |||
27 | show-source = True | 25 | show-source = True |
28 | ignore = E123,E125 | ||
29 | builtins = _ | 26 | builtins = _ |
30 | exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build | 27 | exclude=.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 | |||
18 | import argparse | ||
19 | import subprocess | ||
20 | import sys | ||
21 | |||
22 | import testtools | ||
23 | |||
24 | |||
25 | def 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 | |||
34 | def 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 | |||
47 | if __name__ == '__main__': | ||
48 | sys.exit(main()) | ||