def requires_outputlog(path=".", prefix=""): from nose import SkipTest def ffalse(func): @wraps(func) def fskip(*args, **kwargs): raise SkipTest return fskip def ftrue(func): @wraps(func) def fyielder(*args, **kwargs): with temp_cwd(path): for t in func(*args, **kwargs): if isinstance(t, AnswerTestingTest): t.prefix = prefix yield t return fyielder if os.path.exists("OutputLog"): return ftrue with temp_cwd(path): if os.path.exists("OutputLog"): return ftrue return ffalse
def requires_outputlog(path = ".", prefix = ""): def ffalse(func): return lambda: None def ftrue(func): @wraps(func) def fyielder(*args, **kwargs): with temp_cwd(path): for t in func(*args, **kwargs): if isinstance(t, AnswerTestingTest): t.prefix = prefix yield t return fyielder if os.path.exists("OutputLog"): return ftrue with temp_cwd(path): if os.path.exists("OutputLog"): return ftrue return ffalse
def fyielder(*args, **kwargs): with temp_cwd(path): for t in func(*args, **kwargs): if isinstance(t, AnswerTestingTest): t.prefix = prefix yield t