1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Tools for skipping data tests in cclib."""
def skipForParser(parser, msg):
"""Return a decorator that skips the test for specified parser."""
def testdecorator(testfunc):
def testwrapper(self, *args, **kwargs):
if self.logfile.logname == parser:
self.skipTest(msg)
else:
testfunc(self, *args, **kwargs)
return testwrapper
return testdecorator
def skipForLogfile(fragment, msg):
"""Return a decorator that skips the test for logfiles containing fragment."""
def testdecorator(testfunc):
def testwrapper(self, *args, **kwargs):
if fragment in self.logfile.filename:
self.skipTest(msg)
else:
testfunc(self, *args, **kwargs)
return testwrapper
return testdecorator
|