Call instead of raise pytest.raise()

Why:

* pytest.raise is not an exception.
This commit is contained in:
Charles LeDoux 2017-12-27 17:07:59 -06:00
parent edadb31a2b
commit 4d1b37a58d
1 changed files with 4 additions and 4 deletions

View File

@ -34,7 +34,7 @@ def _need_func(testfunc, name, description):
def check_func(func): def check_func(func):
def newfunc(*args, **kwargs): def newfunc(*args, **kwargs):
if not testfunc(name): if not testfunc(name):
raise pytest.skip("%s %r is not available" % (description, name)) pytest.skip("%s %r is not available" % (description, name))
return func(*args, **kwargs) return func(*args, **kwargs)
setattr(newfunc, fnameattr, getattr(func, fnameattr)) setattr(newfunc, fnameattr, getattr(func, fnameattr))
return newfunc return newfunc
@ -72,9 +72,9 @@ def needs_codec (program, codec):
def check_prog (f): def check_prog (f):
def newfunc (*args, **kwargs): def newfunc (*args, **kwargs):
if not patoolib.util.find_program(program): if not patoolib.util.find_program(program):
raise pytest.skip("program `%s' not available" % program) pytest.skip("program `%s' not available" % program)
if not has_codec(program, codec): if not has_codec(program, codec):
raise pytest.skip("codec `%s' for program `%s' not available" % (codec, program)) pytest.skip("codec `%s' for program `%s' not available" % (codec, program))
return f(*args, **kwargs) return f(*args, **kwargs)
setattr(newfunc, fnameattr, getattr(f, fnameattr)) setattr(newfunc, fnameattr, getattr(f, fnameattr))
return newfunc return newfunc
@ -95,7 +95,7 @@ def skip_on_travis():
def check_func(func): def check_func(func):
def newfunc(*args, **kwargs): def newfunc(*args, **kwargs):
if "TRAVIS" in os.environ: if "TRAVIS" in os.environ:
raise pytest.skip("Skip on TRAVIS CI build.") pytest.skip("Skip on TRAVIS CI build.")
return func(*args, **kwargs) return func(*args, **kwargs)
setattr(newfunc, fnameattr, getattr(func, fnameattr)) setattr(newfunc, fnameattr, getattr(func, fnameattr))
return newfunc return newfunc