def __init__(self, name, workingDir=None): if workingDir is None: workingDir = os.getcwd() self.name = name self.workingDir = workingDir self.filename, self.module, self.call = split_test_name(name) log.debug('Test name %s resolved to file %s, module %s, call %s', name, self.filename, self.module, self.call) if self.filename is None: if self.module is not None: self.filename = getfilename(self.module, self.workingDir) if self.filename: self.filename = src(self.filename) if not op_isabs(self.filename): self.filename = op_abspath(op_join(workingDir, self.filename)) if self.module is None: self.module = getpackage(self.filename) log.debug( 'Final resolution of test name %s: file %s module %s call %s', name, self.filename, self.module, self.call)
def fake_import(package): filename = getfilename(package) if not filename: raise ImportError return filename