Hello community, here is the log from the commit of package python-os-testr for openSUSE:Factory checked in at 2016-05-19 12:14:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-os-testr (Old) and /work/SRC/openSUSE:Factory/.python-os-testr.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-os-testr" Changes: -------- --- /work/SRC/openSUSE:Factory/python-os-testr/python-os-testr.changes 2015-12-13 09:39:59.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-os-testr.new/python-os-testr.changes 2016-05-19 12:14:41.000000000 +0200 @@ -1,0 +2,27 @@ +Thu Mar 3 11:45:23 UTC 2016 - [email protected] + +- Add openstack-macros as BuildRequires for %license tag + +------------------------------------------------------------------- +Thu Mar 3 11:29:50 UTC 2016 - [email protected] + +- update to 0.6.0: + * Support comments in whitelist files + * Add tool to create a subunit stream + * Add support to ostestr to use subunit-trace color + * Fix documentation typos + * Fix coverage section in tox.ini + * Add delete *.pyc command before executing ostestr + * Change to always parsing classes from test_id + * Add colored output feature to subunit-trace + * Add *.egg* to .gitignore + * Fail if no tests were successfully executed + * Fix syntax of the README file +- Add /usr/bin/generate-subunit + +------------------------------------------------------------------- +Thu Feb 25 20:03:29 UTC 2016 - [email protected] + +- adjust to common packaging guidelines + +------------------------------------------------------------------- Old: ---- os-testr-0.4.2.tar.gz New: ---- os-testr-0.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-os-testr.spec ++++++ --- /var/tmp/diff_new_pack.yzl2Gp/_old 2016-05-19 12:14:42.000000000 +0200 +++ /var/tmp/diff_new_pack.yzl2Gp/_new 2016-05-19 12:14:42.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-os-testr # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,25 +17,25 @@ Name: python-os-testr -Version: 0.4.2 +Version: 0.6.0 Release: 0 Summary: A testr wrapper to provide functionality for OpenStack projects License: Apache-2.0 Group: Development/Languages/Python Url: http://www.openstack.org/ Source: https://pypi.python.org/packages/source/o/os-testr/os-testr-%{version}.tar.gz +BuildRequires: openstack-macros +BuildRequires: python-ddt >= 0.4.0 BuildRequires: python-devel -BuildRequires: python-pbr +BuildRequires: python-mock +BuildRequires: python-oslotest >= 1.2.0 +BuildRequires: python-pbr >= 1.3 +BuildRequires: python-testrepository >= 0.0.18 Requires: python-Babel >= 1.3 Requires: python-python-subunit >= 0.0.18 Requires: python-testrepository >= 0.0.18 Requires: python-testtools >= 1.4.0 -BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%else BuildArch: noarch -%endif %description A testr wrapper to provide functionality for OpenStack projects @@ -45,17 +45,20 @@ %setup -q -n os-testr-%{version} %build -python setup.py build +%{__python2} setup.py build %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} +%{__python2} setup.py install --prefix=%{_prefix} --root=%{buildroot} %files %defattr(-,root,root,-) -%doc README.rst ChangeLog LICENSE AUTHORS +%license LICENSE +%doc README.rst ChangeLog AUTHORS %{_bindir}/ostestr %{_bindir}/subunit-trace %{_bindir}/subunit2html -%{python_sitelib}/* +%{_bindir}/generate-subunit +%{python_sitelib}/os_testr +%{python_sitelib}/os_testr*egg-info %changelog ++++++ os-testr-0.4.2.tar.gz -> os-testr-0.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/AUTHORS new/os-testr-0.6.0/AUTHORS --- old/os-testr-0.4.2/AUTHORS 2015-10-01 21:27:57.000000000 +0200 +++ new/os-testr-0.6.0/AUTHORS 2016-01-05 18:39:07.000000000 +0100 @@ -1,9 +1,12 @@ Assaf Muller <[email protected]> +Christian Berendt <[email protected]> Davanum Srinivas <[email protected]> James Page <[email protected]> John Griffith <[email protected]> Kun Huang <[email protected]> +Masayuki Igawa <[email protected]> Matthew Treinish <[email protected]> Monty Taylor <[email protected]> TerryHowe <[email protected]> Thomas Bechtold <[email protected]> +step6829 <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/ChangeLog new/os-testr-0.6.0/ChangeLog --- old/os-testr-0.4.2/ChangeLog 2015-10-01 21:27:57.000000000 +0200 +++ new/os-testr-0.6.0/ChangeLog 2016-01-05 18:39:07.000000000 +0100 @@ -1,6 +1,25 @@ CHANGES ======= +0.6.0 +----- + +* Support comments in whitelist files +* Add tool to create a subunit stream + +0.5.0 +----- + +* Add support to ostestr to use subunit-trace color +* Fix documentation typos +* Fix coverage section in tox.ini +* Add delete *.pyc command before executing ostestr +* Change to always parsing classes from test_id +* Add colored output feature to subunit-trace +* Add *.egg* to .gitignore +* Fail if no tests were successfully executed +* Fix syntax of the README file + 0.4.2 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/PKG-INFO new/os-testr-0.6.0/PKG-INFO --- old/os-testr-0.4.2/PKG-INFO 2015-10-01 21:27:57.000000000 +0200 +++ new/os-testr-0.6.0/PKG-INFO 2016-01-05 18:39:07.000000000 +0100 @@ -1,16 +1,16 @@ Metadata-Version: 1.1 Name: os-testr -Version: 0.4.2 +Version: 0.6.0 Summary: A testr wrapper to provide functionality for OpenStack projects Home-page: http://www.openstack.org/ Author: OpenStack Author-email: [email protected] License: UNKNOWN -Description: =============================== +Description: ======== os-testr - =============================== + ======== - A testr wrapper to provide functionality for OpenStack projects + A testr wrapper to provide functionality for OpenStack projects. * Free software: Apache license * Documentation: http://docs.openstack.org/developer/os-testr @@ -20,11 +20,11 @@ Features -------- - * ostestr: a testr wrapper that uses subunit-trace for output and builds some - helpful extra functionality around testr - * subunit-trace: an output filter for a subunit stream which provides useful - information about the run - * subunit2html: generates a test results html page from a subunit stream + * ``ostestr``: a testr wrapper that uses subunit-trace for output and builds + some helpful extra functionality around testr + * ``subunit-trace``: an output filter for a subunit stream which provides + useful information about the run + * ``subunit2html``: generates a test results html page from a subunit stream Platform: UNKNOWN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/README.rst new/os-testr-0.6.0/README.rst --- old/os-testr-0.4.2/README.rst 2015-10-01 21:27:31.000000000 +0200 +++ new/os-testr-0.6.0/README.rst 2016-01-05 18:38:43.000000000 +0100 @@ -1,8 +1,8 @@ -=============================== +======== os-testr -=============================== +======== -A testr wrapper to provide functionality for OpenStack projects +A testr wrapper to provide functionality for OpenStack projects. * Free software: Apache license * Documentation: http://docs.openstack.org/developer/os-testr @@ -12,8 +12,8 @@ Features -------- -* ostestr: a testr wrapper that uses subunit-trace for output and builds some - helpful extra functionality around testr -* subunit-trace: an output filter for a subunit stream which provides useful - information about the run -* subunit2html: generates a test results html page from a subunit stream +* ``ostestr``: a testr wrapper that uses subunit-trace for output and builds + some helpful extra functionality around testr +* ``subunit-trace``: an output filter for a subunit stream which provides + useful information about the run +* ``subunit2html``: generates a test results html page from a subunit stream diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/doc/source/ostestr.rst new/os-testr-0.6.0/doc/source/ostestr.rst --- old/os-testr-0.4.2/doc/source/ostestr.rst 2015-10-01 21:27:31.000000000 +0200 +++ new/os-testr-0.6.0/doc/source/ostestr.rst 2016-01-05 18:38:43.000000000 +0100 @@ -112,7 +112,7 @@ $ ostestr --regex 'magic\.regex' This will do a straight passthrough of the provided regex to testr. -Additionally, ostestr allows you to specify a a blacklist file to define a set +Additionally, ostestr allows you to specify a blacklist file to define a set of regexes to exclude. You can specify a blacklist file with the --blacklist-file/-b option, for example:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/doc/source/subunit_trace.rst new/os-testr-0.6.0/doc/source/subunit_trace.rst --- old/os-testr-0.4.2/doc/source/subunit_trace.rst 2015-10-01 21:27:31.000000000 +0200 +++ new/os-testr-0.6.0/doc/source/subunit_trace.rst 2016-01-05 18:38:43.000000000 +0100 @@ -20,7 +20,7 @@ Disable printing failure debug information in realtime --fails, -f Print failure debug information after the stream is - proccesed + processed --failonly Don't print success items --perc-diff, -d @@ -58,7 +58,7 @@ $ testr run --subunit | subunit-trace --no-failure-debug -Rhere is also the option to print all failures together at the end of the test +Here is also the option to print all failures together at the end of the test run before the summary view. This is done using the --fails/-f option. For example:: @@ -77,7 +77,7 @@ $ testr run --subunit | subunit-trace --failonly -The last output option provided by subunit-trace is to diable the summary view +The last output option provided by subunit-trace is to disable the summary view of the test run which is normally displayed at the end of a run. You can do this using the --no-summary option. For example:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/os_testr/generate_subunit.py new/os-testr-0.6.0/os_testr/generate_subunit.py --- old/os-testr-0.4.2/os_testr/generate_subunit.py 1970-01-01 01:00:00.000000000 +0100 +++ new/os-testr-0.6.0/os_testr/generate_subunit.py 2016-01-05 18:38:44.000000000 +0100 @@ -0,0 +1,50 @@ +#!/usr/bin/env python2 +# Copyright 2015 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +import datetime +import sys + +import subunit +from subunit import iso8601 + + +def main(): + start_time = datetime.datetime.fromtimestamp(float(sys.argv[1])).replace( + tzinfo=iso8601.UTC) + elapsed_time = datetime.timedelta(seconds=int(sys.argv[2])) + stop_time = start_time + elapsed_time + + if len(sys.argv) > 3: + status = sys.argv[3] + else: + status = 'success' + + if len(sys.argv) > 4: + test_id = sys.argv[4] + else: + test_id = 'devstack' + + # Write the subunit test + output = subunit.v2.StreamResultToBytes(sys.stdout) + output.startTestRun() + output.status(timestamp=start_time, test_id=test_id) + # Write the end of the test + output.status(test_status=status, timestamp=stop_time, test_id=test_id) + output.stopTestRun() + + +if __name__ == '__main__': + main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/os_testr/os_testr.py new/os-testr-0.6.0/os_testr/os_testr.py --- old/os-testr-0.4.2/os_testr/os_testr.py 2015-10-01 21:27:31.000000000 +0200 +++ new/os-testr-0.6.0/os_testr/os_testr.py 2016-01-05 18:38:44.000000000 +0100 @@ -58,6 +58,8 @@ 'this is mutually exclusive with --pretty') parser.add_argument('--list', '-l', action='store_true', help='List all the tests which will be run.') + parser.add_argument('--color', action='store_true', + help='Use color in the pretty output') slowest = parser.add_mutually_exclusive_group() slowest.add_argument('--slowest', dest='slowest', action='store_true', help="after the test run print the slowest tests") @@ -130,7 +132,14 @@ def get_regex_from_whitelist_file(file_path): - return '|'.join(open(file_path).read().splitlines()) + lines = [] + for line in open(file_path).read().splitlines(): + split_line = line.strip().split('#') + # Before the # is the regex + line_regex = split_line[0].strip() + if line_regex: + lines.append(line_regex) + return '|'.join(lines) def construct_regex(blacklist_file, whitelist_file, regex, print_exclude): @@ -166,7 +175,7 @@ def call_testr(regex, subunit, pretty, list_tests, slowest, parallel, concur, - until_failure): + until_failure, color): if parallel: cmd = ['testr', 'run', '--parallel'] if concur: @@ -181,6 +190,12 @@ cmd.append('--until-failure') cmd.append(regex) env = copy.deepcopy(os.environ) + + if pretty: + subunit_trace_cmd = ['subunit-trace', '--no-failure-debug', '-f'] + if color: + subunit_trace_cmd.append('--color') + # This workaround is necessary because of lp bug 1411804 it's super hacky # and makes tons of unfounded assumptions, but it works for the most part if (subunit or pretty) and until_failure: @@ -198,9 +213,9 @@ if pretty: cmd = ['python', '-m', 'subunit.run', test] ps = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE) - proc = subprocess.Popen(['subunit-trace', - '--no-failure-debug', '-f', - '--no-summary'], env=env, + subunit_trace_cmd.append('--no-summary') + proc = subprocess.Popen(subunit_trace_cmd, + env=env, stdin=ps.stdout) ps.stdout.close() proc.communicate() @@ -223,7 +238,7 @@ # If not until-failure special case call testr like normal elif pretty and not list_tests: ps = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE) - proc = subprocess.Popen(['subunit-trace', '--no-failure-debug', '-f'], + proc = subprocess.Popen(subunit_trace_cmd, env=env, stdin=ps.stdout) ps.stdout.close() else: @@ -261,7 +276,7 @@ if not opts.no_discover and not opts.pdb: ec = call_testr(exclude_regex, opts.subunit, opts.pretty, opts.list, opts.slowest, opts.parallel, opts.concurrency, - opts.until_failure) + opts.until_failure, opts.color) else: test_to_run = opts.no_discover or opts.pdb if test_to_run.find('/') != -1: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/os_testr/subunit2html.py new/os-testr-0.6.0/os_testr/subunit2html.py --- old/os-testr-0.4.2/os_testr/subunit2html.py 2015-10-01 21:27:31.000000000 +0200 +++ new/os-testr-0.6.0/os_testr/subunit2html.py 2016-01-05 18:38:43.000000000 +0100 @@ -633,10 +633,10 @@ test = test.test if test.__class__ == subunit.RemotedTestCase: cl = test._RemotedTestCase__description.rsplit('.', 1)[0] - mod = cl.rsplit('.', 1)[0] - cls = ClassInfoWrapper(cl, mod) else: - cls = ClassInfoWrapper(str(test.__class__), str(test.__module__)) + cl = test.id().rsplit('.', 1)[0] + mod = cl.rsplit('.', 1)[0] + cls = ClassInfoWrapper(cl, mod) if not str(cls) in rmap: rmap[str(cls)] = [] classes.append(cls) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/os_testr/subunit_trace.py new/os-testr-0.6.0/os_testr/subunit_trace.py --- old/os-testr-0.4.2/os_testr/subunit_trace.py 2015-10-01 21:27:32.000000000 +0200 +++ new/os-testr-0.6.0/os_testr/subunit_trace.py 2016-01-05 18:38:43.000000000 +0100 @@ -17,6 +17,7 @@ # under the License. """Trace a subunit stream in reasonable detail and high accuracy.""" +from __future__ import absolute_import import argparse import datetime @@ -28,6 +29,8 @@ import subunit import testtools +from os_testr.utils import colorizer + # NOTE(mtreinish) on python3 anydbm was renamed dbm and the python2 dbm module # was renamed to dbm.ndbm, this block takes that into account try: @@ -148,7 +151,8 @@ def show_outcome(stream, test, print_failures=False, failonly=False, - enable_diff=False, threshold='0', abbreviate=False): + enable_diff=False, threshold='0', abbreviate=False, + enable_color=False): global RESULTS status = test['status'] # TODO(sdague): ask lifeless why on this? @@ -167,19 +171,29 @@ if name == 'process-returncode': return + for color in [colorizer.AnsiColorizer, colorizer.NullColorizer]: + if not enable_color: + color = colorizer.NullColorizer(stream) + break + if color.supported(): + color = color(stream) + break + if status == 'fail': FAILS.append(test) if abbreviate: - stream.write('F') + color.write('F', 'red') else: - stream.write('{%s} %s [%s] ... FAILED\n' % ( + stream.write('{%s} %s [%s] ... ' % ( worker, name, duration)) + color.write('FAILED', 'red') + stream.write('\n') if not print_failures: print_attachments(stream, test, all_channels=True) elif not failonly: if status == 'success': if abbreviate: - stream.write('.') + color.write('.', 'green') else: out_string = '{%s} %s [%s' % (worker, name, duration) perc_diff = find_test_run_time_diff(test['id'], duration) @@ -189,17 +203,22 @@ out_string = out_string + ' +%.2f%%' % perc_diff else: out_string = out_string + ' %.2f%%' % perc_diff - stream.write(out_string + '] ... ok\n') + stream.write(out_string + '] ... ') + color.write('ok', 'green') + stream.write('\n') print_attachments(stream, test) elif status == 'skip': if abbreviate: - stream.write('S') + color.write('S', 'blue') else: reason = test['details'].get('reason', '') if reason: reason = ': ' + reason.as_text() - stream.write('{%s} %s ... SKIPPED%s\n' % ( - worker, name, reason)) + stream.write('{%s} %s ... ' % ( + worker, name)) + color.write('SKIPPED', 'blue') + stream.write('%s' % (reason)) + stream.write('\n') else: if abbreviate: stream.write('%s' % test['status'][0]) @@ -320,6 +339,8 @@ parser.add_argument('--no-summary', action='store_true', help="Don't print the summary of the test run after " " completes") + parser.add_argument('--color', action='store_true', + help="Print results with colors") return parser.parse_args() @@ -332,7 +353,8 @@ print_failures=args.print_failures, failonly=args.failonly, enable_diff=args.enable_diff, - abbreviate=args.abbreviate)) + abbreviate=args.abbreviate, + enable_color=args.color)) summary = testtools.StreamSummary() result = testtools.CopyStreamResult([outcomes, summary]) result = testtools.StreamResultRouter(result) @@ -354,6 +376,12 @@ print_fails(sys.stdout) if not args.no_summary: print_summary(sys.stdout, elapsed_time) + + # NOTE(mtreinish): Ideally this should live in testtools streamSummary + # this is just in place until the behavior lands there (if it ever does) + if count_tests('status', '^success$') == 0: + print("\nNo tests were successful during the run") + exit(1) exit(0 if summary.wasSuccessful() else 1) Files old/os-testr-0.4.2/os_testr/tests/sample_streams/all_skips.subunit and new/os-testr-0.6.0/os_testr/tests/sample_streams/all_skips.subunit differ Files old/os-testr-0.4.2/os_testr/tests/sample_streams/successful.subunit and new/os-testr-0.6.0/os_testr/tests/sample_streams/successful.subunit differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/os_testr/tests/test_os_testr.py new/os-testr-0.6.0/os_testr/tests/test_os_testr.py --- old/os-testr-0.4.2/os_testr/tests/test_os_testr.py 2015-10-01 21:27:31.000000000 +0200 +++ new/os-testr-0.6.0/os_testr/tests/test_os_testr.py 2016-01-05 18:38:44.000000000 +0100 @@ -144,6 +144,18 @@ result, "^((?!fake_regex_3|fake_regex_2|fake_regex_1|fake_regex_0).)*$") + def test_whitelist_regex_with_comments(self): + whitelist_file = six.StringIO() + for i in range(4): + whitelist_file.write('fake_regex_%s # A Comment\n' % i) + whitelist_file.seek(0) + with mock.patch('six.moves.builtins.open', + return_value=whitelist_file): + result = os_testr.construct_regex(None, 'fake_path', None, False) + self.assertEqual( + result, + "fake_regex_0|fake_regex_1|fake_regex_2|fake_regex_3") + def test_blacklist_regex_without_comments(self): blacklist_file = six.StringIO() for i in range(4): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/os_testr/tests/test_subunit2html.py new/os-testr-0.6.0/os_testr/tests/test_subunit2html.py --- old/os-testr-0.4.2/os_testr/tests/test_subunit2html.py 1970-01-01 01:00:00.000000000 +0100 +++ new/os-testr-0.6.0/os_testr/tests/test_subunit2html.py 2016-01-05 18:38:43.000000000 +0100 @@ -0,0 +1,31 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from ddt import data +from ddt import ddt +from subunit import RemotedTestCase +from testtools import PlaceHolder + +from os_testr import subunit2html +from os_testr.tests import base + + +@ddt +class TestSubunit2html(base.TestCase): + @data(RemotedTestCase, PlaceHolder) + def test_class_parsing(self, test_cls): + """Tests that the class paths are parsed for v1 & v2 tests""" + test_ = test_cls("example.path.to.test.method") + obj_ = subunit2html.HtmlOutput() + cls_ = [] + obj_._add_cls({}, cls_, test_, ()) + self.assertEqual("example.path.to.test", cls_[0].name) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/os_testr/tests/test_subunit_trace.py new/os-testr-0.6.0/os_testr/tests/test_subunit_trace.py --- old/os-testr-0.4.2/os_testr/tests/test_subunit_trace.py 2015-10-01 21:27:31.000000000 +0200 +++ new/os-testr-0.6.0/os_testr/tests/test_subunit_trace.py 2016-01-05 18:38:43.000000000 +0100 @@ -14,6 +14,8 @@ # under the License. from datetime import datetime as dt +import os +import subprocess from ddt import data from ddt import ddt @@ -59,3 +61,21 @@ } with patch.dict(subunit_trace.RESULTS, patched_res, clear=True): self.assertEqual(subunit_trace.run_time(), expected_result) + + def test_return_code_all_skips(self): + skips_stream = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + 'sample_streams/all_skips.subunit') + p = subprocess.Popen(['subunit-trace'], stdin=subprocess.PIPE) + with open(skips_stream, 'rb') as stream: + p.communicate(stream.read()) + self.assertEqual(1, p.returncode) + + def test_return_code_normal_run(self): + regular_stream = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + 'sample_streams/successful.subunit') + p = subprocess.Popen(['subunit-trace'], stdin=subprocess.PIPE) + with open(regular_stream, 'rb') as stream: + p.communicate(stream.read()) + self.assertEqual(0, p.returncode) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/os_testr/utils/colorizer.py new/os-testr-0.6.0/os_testr/utils/colorizer.py --- old/os-testr-0.4.2/os_testr/utils/colorizer.py 1970-01-01 01:00:00.000000000 +0100 +++ new/os-testr-0.6.0/os_testr/utils/colorizer.py 2016-01-05 18:38:43.000000000 +0100 @@ -0,0 +1,98 @@ +# Copyright 2015 NEC Corporation +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# Colorizer Code is borrowed from Twisted: +# Copyright (c) 2001-2010 Twisted Matrix Laboratories. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +import sys + + +class AnsiColorizer(object): + """A colorizer is an object that loosely wraps around a stream + + allowing callers to write text to the stream in a particular color. + + Colorizer classes must implement C{supported()} and C{write(text, color)}. + """ + _colors = dict(black=30, red=31, green=32, yellow=33, + blue=34, magenta=35, cyan=36, white=37) + + def __init__(self, stream): + self.stream = stream + + @classmethod + def supported(cls, stream=sys.stdout): + """Check the current platform supports coloring terminal output + + A class method that returns True if the current platform supports + coloring terminal output using this method. Returns False otherwise. + """ + if not stream.isatty(): + return False # auto color only on TTYs + try: + import curses + except ImportError: + return False + else: + try: + try: + return curses.tigetnum("colors") > 2 + except curses.error: + curses.setupterm() + return curses.tigetnum("colors") > 2 + except Exception: + # guess false in case of error + return False + + def write(self, text, color): + """Write the given text to the stream in the given color. + + @param text: Text to be written to the stream. + + @param color: A string label for a color. e.g. 'red', 'white'. + """ + color = self._colors[color] + self.stream.write('\x1b[%s;1m%s\x1b[0m' % (color, text)) + + +class NullColorizer(object): + """See _AnsiColorizer docstring.""" + def __init__(self, stream): + self.stream = stream + + @classmethod + def supported(cls, stream=sys.stdout): + return True + + def write(self, text, color): + self.stream.write(text) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/os_testr.egg-info/PKG-INFO new/os-testr-0.6.0/os_testr.egg-info/PKG-INFO --- old/os-testr-0.4.2/os_testr.egg-info/PKG-INFO 2015-10-01 21:27:57.000000000 +0200 +++ new/os-testr-0.6.0/os_testr.egg-info/PKG-INFO 2016-01-05 18:39:07.000000000 +0100 @@ -1,16 +1,16 @@ Metadata-Version: 1.1 Name: os-testr -Version: 0.4.2 +Version: 0.6.0 Summary: A testr wrapper to provide functionality for OpenStack projects Home-page: http://www.openstack.org/ Author: OpenStack Author-email: [email protected] License: UNKNOWN -Description: =============================== +Description: ======== os-testr - =============================== + ======== - A testr wrapper to provide functionality for OpenStack projects + A testr wrapper to provide functionality for OpenStack projects. * Free software: Apache license * Documentation: http://docs.openstack.org/developer/os-testr @@ -20,11 +20,11 @@ Features -------- - * ostestr: a testr wrapper that uses subunit-trace for output and builds some - helpful extra functionality around testr - * subunit-trace: an output filter for a subunit stream which provides useful - information about the run - * subunit2html: generates a test results html page from a subunit stream + * ``ostestr``: a testr wrapper that uses subunit-trace for output and builds + some helpful extra functionality around testr + * ``subunit-trace``: an output filter for a subunit stream which provides + useful information about the run + * ``subunit2html``: generates a test results html page from a subunit stream Platform: UNKNOWN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/os_testr.egg-info/SOURCES.txt new/os-testr-0.6.0/os_testr.egg-info/SOURCES.txt --- old/os-testr-0.4.2/os_testr.egg-info/SOURCES.txt 2015-10-01 21:27:57.000000000 +0200 +++ new/os-testr-0.6.0/os_testr.egg-info/SOURCES.txt 2016-01-05 18:39:07.000000000 +0100 @@ -28,6 +28,7 @@ doc/source/todo.rst doc/source/usage.rst os_testr/__init__.py +os_testr/generate_subunit.py os_testr/os_testr.py os_testr/subunit2html.py os_testr/subunit_trace.py @@ -43,9 +44,14 @@ os_testr/tests/base.py os_testr/tests/test_os_testr.py os_testr/tests/test_return_codes.py +os_testr/tests/test_subunit2html.py os_testr/tests/test_subunit_trace.py os_testr/tests/files/__init__.py os_testr/tests/files/failing-tests os_testr/tests/files/passing-tests os_testr/tests/files/setup.cfg -os_testr/tests/files/testr-conf \ No newline at end of file +os_testr/tests/files/testr-conf +os_testr/tests/sample_streams/all_skips.subunit +os_testr/tests/sample_streams/successful.subunit +os_testr/utils/__init__.py +os_testr/utils/colorizer.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/os_testr.egg-info/entry_points.txt new/os-testr-0.6.0/os_testr.egg-info/entry_points.txt --- old/os-testr-0.4.2/os_testr.egg-info/entry_points.txt 2015-10-01 21:27:57.000000000 +0200 +++ new/os-testr-0.6.0/os_testr.egg-info/entry_points.txt 2016-01-05 18:39:07.000000000 +0100 @@ -1,4 +1,5 @@ [console_scripts] +generate-subunit = os_testr.generate_subunit:main ostestr = os_testr.os_testr:main subunit-trace = os_testr.subunit_trace:main subunit2html = os_testr.subunit2html:main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/os_testr.egg-info/pbr.json new/os-testr-0.6.0/os_testr.egg-info/pbr.json --- old/os-testr-0.4.2/os_testr.egg-info/pbr.json 2015-10-01 21:27:57.000000000 +0200 +++ new/os-testr-0.6.0/os_testr.egg-info/pbr.json 2016-01-05 18:39:07.000000000 +0100 @@ -1 +1 @@ -{"git_version": "65e1e18", "is_release": true} \ No newline at end of file +{"is_release": true, "git_version": "29c64b1"} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/setup.cfg new/os-testr-0.6.0/setup.cfg --- old/os-testr-0.4.2/setup.cfg 2015-10-01 21:27:57.000000000 +0200 +++ new/os-testr-0.6.0/setup.cfg 2016-01-05 18:39:07.000000000 +0100 @@ -29,6 +29,7 @@ subunit-trace = os_testr.subunit_trace:main ostestr = os_testr.os_testr:main subunit2html = os_testr.subunit2html:main + generate-subunit = os_testr.generate_subunit:main [build_sphinx] source-dir = doc/source @@ -53,7 +54,7 @@ output_file = os_testr/locale/os-testr.pot [egg_info] -tag_svn_revision = 0 tag_build = +tag_svn_revision = 0 tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-testr-0.4.2/tox.ini new/os-testr-0.6.0/tox.ini --- old/os-testr-0.4.2/tox.ini 2015-10-01 21:27:31.000000000 +0200 +++ new/os-testr-0.6.0/tox.ini 2016-01-05 18:38:43.000000000 +0100 @@ -8,9 +8,12 @@ install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} +whitelist_externals = find deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = ostestr {posargs} +commands = + find . -type f -name "*.pyc" -delete + ostestr {posargs} [testenv:pep8] commands = flake8 @@ -19,7 +22,7 @@ commands = {posargs} [testenv:cover] -commands = python setup.py testr --coverage --testr-args='{posargs}' +commands = python setup.py testr --coverage --coverage-package-name='os_testr' --testr-args='{posargs}' [testenv:docs] commands = python setup.py build_sphinx
