summaryrefslogtreecommitdiff
path: root/pytest.py
diff options
context:
space:
mode:
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2009-07-29 11:44:15 +0200
committerAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2009-07-29 11:44:15 +0200
commit96e6c8e68fdfe095287a97a327cbec65b847fe26 (patch)
tree6bcf9f52ed3afec911d332600af7a4d60f40cb2c /pytest.py
parent87d36391219454cea3496a1aa7d64d114b7b503d (diff)
downloadlogilab-common-96e6c8e68fdfe095287a97a327cbec65b847fe26.tar.gz
[pytest] -c option now caputres DeprecationWarnings
Diffstat (limited to 'pytest.py')
-rw-r--r--pytest.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/pytest.py b/pytest.py
index 68ffe43..38b68fe 100644
--- a/pytest.py
+++ b/pytest.py
@@ -108,7 +108,7 @@ pytest --coverage test_foo.py
import os, sys, re
import os.path as osp
from time import time, clock
-
+import warnings
from logilab.common.fileutils import abspath_listdir
from logilab.common import testlib
@@ -573,7 +573,6 @@ def make_parser():
"""carry the option to unittest_main"""
parser.newargs.append(opt)
-
def rebuild_and_store(option, opt, value, parser):
"""carry the option to unittest_main and store
the value on current parser
@@ -581,6 +580,10 @@ def make_parser():
parser.newargs.append(opt)
setattr(parser.values, option.dest, True)
+ def capture_and_rebuild(option, opt, value, parser):
+ warnings.simplefilter('ignore', DeprecationWarning)
+ rebuild_cmdline(option, opt, value, parser)
+
# pytest options
parser.add_option('-t', dest='testdir', default=None,
help="directory where the tests will be found")
@@ -601,7 +604,7 @@ def make_parser():
action="callback",
help="Restart tests from where it failed (implies exitfirst) "
"(only make sense if tests previously ran with exitfirst only)")
- parser.add_option('-c', '--capture', callback=rebuild_cmdline,
+ parser.add_option('-c', '--capture', callback=capture_and_rebuild,
action="callback",
help="Captures and prints standard out/err only on errors "
"(only make sense when pytest run one test file)")