def __init__(self, package, setup=None, teardown=None, globs=None, optionflags=None, encoding=None, checker=None, allow_teardown=False, **kw): BasicTestSetup.__init__(self, package, **kw) self.setUp = setup or self.setUp self.tearDown = teardown or self.tearDown self.encoding = encoding or self.encoding self.checker = checker or self.checker if globs is not None: self.globs = globs if optionflags is not None: self.optionflags = optionflags self.allow_teardown = allow_teardown
def __init__(self, package, pfilter_func=None, regexp_list=None): BasicTestSetup.__init__(self, package, regexp_list=regexp_list) self.pfilter_func = pfilter_func or self.isTestModule self.filter_func = self.pfilter_func
def test_file_contains_copes_with_strange_encodings(self): # we can also parse files that are not utf-8 or similar mysetup = BasicTestSetup(cave, regexp_list=["MARKER", ]) path = self.create_file(b"Line 1\n \xff\xfeW[ \nMARKER\n\n") assert mysetup.fileContains(path) is True
def test_file_contains_no_match(self): # fileContains might find no match mysetup = BasicTestSetup(cave, regexp_list=["MARKER", ]) path = self.create_file(b"Line 1\nLine 2\nLine 3\n\n") assert mysetup.fileContains(path) is False
def test_file_contains_match(self): # the fileContains method finds matches mysetup = BasicTestSetup(cave, regexp_list=["MARKER", ]) path = self.create_file(b"Line 1\nLine 2\nMARKER in file\n\n") assert mysetup.fileContains(path) is True