def test_whichgen_verbose(self): testdir = self.testdirs[0].name arg = 'whichtestapp1' matches = list(_which.whichgen(arg, path=[testdir], verbose=True)) assert len(matches) == 1 match, from_where = matches[0] assert self._file_match(match, os.path.join(testdir, arg)) assert from_where == 'from given path element 0'
def test_whichgen_multiple(self): testdir0 = self.testdirs[0].name testdir1 = self.testdirs[1].name arg = 'whichtestapp1' matches = list(_which.whichgen(arg, path=[testdir0, testdir1])) assert len(matches) == 2 assert self._file_match(matches[0][0], os.path.join(testdir0, arg)) assert self._file_match(matches[1][0], os.path.join(testdir1, arg))
def test_whichgen_multiple(self): testdir0 = self.testdirs[0].name testdir1 = self.testdirs[1].name arg = 'whichtestapp1' matches = list(_which.whichgen(arg, path=[testdir0, testdir1])) assert len(matches) == 2 assert self._file_match(matches[0], os.path.join(testdir0, arg)) assert self._file_match(matches[1], os.path.join(testdir1, arg))
def test_whichgen_failure(self): testdir = self.testdirs[0].name arg = 'not_a_file' matches = list(_which.whichgen(arg, path=[testdir])) assert len(matches) == 0
def test_whichgen(self): testdir = self.testdirs[0].name arg = 'whichtestapp1' matches = list(_which.whichgen(arg, path=[testdir])) assert len(matches) == 1 assert self._file_match(matches[0], os.path.join(testdir, arg))
def test_whichgen_ext_success(self): testdir = self.testdirs[0].name arg = 'whichtestapp2' matches = list(_which.whichgen(arg, path=[testdir], exts = ['.wta'])) assert len(matches) == 1 assert self._file_match(matches[0], os.path.join(testdir, arg))
def test_whichgen_ext_failure(self): testdir = self.testdirs[0].name arg = 'whichtestapp2' matches = list(_which.whichgen(arg, path=[testdir])) assert len(matches) == 0
def test_whichgen_failure(self): testdir = self.testdirs[0].name arg = 'not_a_file' matches = list(_which.whichgen(arg, path=[testdir], exts=self.exts)) assert len(matches) == 0
def test_whichgen(self): testdir = self.testdirs[0].name arg = 'whichtestapp1' matches = list(_which.whichgen(arg, path=[testdir], exts=self.exts)) assert len(matches) == 1 assert self._file_match(matches[0][0], os.path.join(testdir, arg))
def test_whichgen_ext_success(self): testdir = self.testdirs[0].name arg = 'whichtestapp2' matches = list(_which.whichgen(arg, path=[testdir], exts=['.wta'])) assert len(matches) == 1 assert self._file_match(matches[0][0], os.path.join(testdir, arg))