From 9ab256c296a18184ea99c605fa05616a49b90e11 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Tue, 7 Dec 2010 12:18:24 +0100 Subject: [PATCH] make getvalueorskip() be hidden in skip-reporting. also bump version. --- _pytest/config.py | 4 +++- pytest.py | 2 +- setup.py | 2 +- testing/test_config.py | 11 +++++++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/_pytest/config.py b/_pytest/config.py index 2becdc91c..d5899368f 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -399,7 +399,9 @@ class Config(object): return self._getconftest(name, path, check=False) def getvalueorskip(self, name, path=None): - """ (deprecated) return getvalue(name) or call py.test.skip if no value exists. """ + """ (deprecated) return getvalue(name) or call + py.test.skip if no value exists. """ + __tracebackhide__ = True try: val = self.getvalue(name, path) if val is None: diff --git a/pytest.py b/pytest.py index 615af2328..af6332778 100644 --- a/pytest.py +++ b/pytest.py @@ -1,7 +1,7 @@ """ unit and functional testing with Python. """ -__version__ = '2.0.1.dev3' +__version__ = '2.0.1.dev4' __all__ = ['main'] from _pytest.core import main, UsageError, _preloadplugins diff --git a/setup.py b/setup.py index 7add3678c..67767b7a8 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ def main(): name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.0.1.dev3', + version='2.0.1.dev4', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff --git a/testing/test_config.py b/testing/test_config.py index c3257ac20..b2ee0f190 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -111,8 +111,15 @@ class TestConfigAPI: verbose = config.getvalueorskip("verbose") assert verbose == config.option.verbose config.option.hello = None - pytest.raises(pytest.skip.Exception, - "config.getvalueorskip('hello')") + try: + config.getvalueorskip('hello') + except KeyboardInterrupt: + raise + except: + excinfo = py.code.ExceptionInfo() + frame = excinfo.traceback[-2].frame + assert frame.code.name == "getvalueorskip" + assert frame.eval("__tracebackhide__") def test_config_overwrite(self, testdir): o = testdir.tmpdir