diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-06-20 16:27:36 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-06-20 16:27:36 +0100 |
commit | a7d5329e97d38058f96b68f19334622962f8f580 (patch) | |
tree | 1fe346a2eded8c1c2faab286b0fec3cd84f25ad9 | |
parent | 7561fe1790fa0aa638a9114def0c17742b4a3d3d (diff) | |
parent | d7b5706244fca58d8a2564ba6394cb460d2ca2c6 (diff) | |
download | python-coverage-test-runner-a7d5329e97d38058f96b68f19334622962f8f580.tar.gz |
Merge remote-tracking branch 'origin/trunk' into baserock/liw/upgrade
Merge in current upstream version. This particularly makes unit tests
that use logging not print out logging messages to the terminal.
-rw-r--r-- | CoverageTestRunner.py | 29 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | NEWS | 15 | ||||
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | debian/changelog | 18 | ||||
-rw-r--r-- | project.meta | 2 | ||||
-rw-r--r-- | setup.py | 4 | ||||
-rw-r--r-- | subdir/foo.py | 3 |
8 files changed, 74 insertions, 8 deletions
diff --git a/CoverageTestRunner.py b/CoverageTestRunner.py index 04cd791..88987a1 100644 --- a/CoverageTestRunner.py +++ b/CoverageTestRunner.py @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2011 Lars Wirzenius <liw@iki.fi> +# Copyright (C) 2007-2013 Lars Wirzenius <liw@iki.fi> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,6 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# =*= License: GPL-3+ =*= import coverage import unittest @@ -20,9 +22,19 @@ import os import imp import sys import time +import logging + + +__version__ = '1.10' + + +class AllowNothing(logging.Filter): -__version__ = '1.7.1' + '''A logging library filter that disables everything.''' + + def filter(self, record): + return False class CoverageTestResult(unittest.TestResult): @@ -89,7 +101,8 @@ class CoverageTestRunner: self._module_pairs = [] self._missing_test_modules = [] self._excluded_modules = [] - + self.allow_nothing = AllowNothing() + def add_pair(self, module_pathname, test_module_pathname): """Add a module and its test module to list of tests.""" self._module_pairs.append((module_pathname, test_module_pathname)) @@ -165,6 +178,14 @@ class CoverageTestRunner: print "%s: %s" % (flavor, str(test)) print str(error) + def enable_logging(self): + logger = logging.getLogger() + logger.removeFilter(self.allow_nothing) + + def disable_logging(self): + logger = logging.getLogger() + logger.addFilter(self.allow_nothing) + def run(self): start_time = time.time() @@ -183,7 +204,9 @@ class CoverageTestRunner: sys.path.insert(0, os.path.dirname(module.__file__)) reload(module) del sys.path[0] + self.disable_logging() suite.run(result) + self.enable_logging() coverage.stop() filename, stmts, excluded, missed, missed_desc = \ coverage.analysis2(module) @@ -1,3 +1,5 @@ +# Copyright: 2007-2013 Lars Wirzenius +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -10,6 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# =*= License: GPL-3+ =*= all: @@ -1,11 +1,24 @@ NEWS about CoverageTestRunner ============================= -Version 1.8, released UNRELEASED +Version 1.10, released 2013-04-17 +-------------------------------- + +* New release to trigger builds for all relevant targets. +* Copyright license summary markup added. + +Version 1.9, released 2012-09-23 +-------------------------------- + +* Home page address updated. + +Version 1.8, released 2012-01-19 -------------------------------- * Progress reporting is now disabled when output does not go to a terminal. This will make build logs prettier. +* `logging` output is now disabled when unit tests are run. This means that + individual projects no longer need to hide the output themselves. Version 1.7.1, released 2011-09-04 -------------------------------- @@ -147,7 +147,7 @@ Rees and is now maintained by Net Batchelder. Its home page is at CoverageTestRunner was written by Lars Wirzenius (`liw@liw.fi`). The home page is at - http://braawi.org/coveragetestrunner.html + http://liw.fi/coverage-test-runner/ I welcome any feedback you may have. @@ -155,7 +155,7 @@ I welcome any feedback you may have. License -------- -Copyright 2007-2011 Lars Wirzenius <liw@liw.fi> +Copyright 2007-2013 Lars Wirzenius <liw@liw.fi> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -169,3 +169,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. + +=*= License: GPL-3+ =*= + diff --git a/debian/changelog b/debian/changelog index 435b21c..ff7832e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,21 @@ +python-coverage-test-runner (1.10-1) unstable; urgency=low + + * New upstream release. + + -- Lars Wirzenius <liw@liw.fi> Wed, 17 Apr 2013 14:26:33 +0100 + +python-coverage-test-runner (1.9-1) unstable; urgency=low + + * New upstream release. + + -- Lars Wirzenius <liw@liw.fi> Sun, 23 Sep 2012 21:50:19 +0100 + +python-coverage-test-runner (1.8-1) unstable; urgency=low + + * New upstream release. + + -- Lars Wirzenius <liw@liw.fi> Thu, 19 Jan 2012 11:27:56 +0000 + python-coverage-test-runner (1.7.1-1) unstable; urgency=low * New upstream release. diff --git a/project.meta b/project.meta deleted file mode 100644 index 17851f6..0000000 --- a/project.meta +++ /dev/null @@ -1,2 +0,0 @@ -[config] -basetgz = /home/pbuilder-tgz/sid-amd64-pristine.tgz, squeeze:/home/pbuilder-tgz/squeeze-amd64-custom.tgz @@ -1,3 +1,5 @@ +# Copyright 2007-2013 Lars Wirzenius +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or @@ -11,6 +13,8 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# =*= License: GPL-3+ =*= from distutils.core import setup diff --git a/subdir/foo.py b/subdir/foo.py index 711ab4d..51a5dde 100644 --- a/subdir/foo.py +++ b/subdir/foo.py @@ -1,6 +1,9 @@ +import logging + class Foo: def foo(self, a): + logging.error('this should not be displayed when testrun runs') if a: return True elif False: # pragma: no cover |