def test_gather_tests_single_file_exec(shell_runner): uuid1 = str(uuid.uuid4()) uuid2 = str(uuid.uuid4()) uuid3 = str(uuid.uuid4()) tdir = tempfile.mkdtemp() tdir2 = os.path.join(tdir, uuid1) tdir3 = os.path.join(tdir2, uuid3) os.mkdir(tdir2) os.mkdir(tdir3) tmp1 = os.path.join(tdir, uuid2) tmp2 = os.path.join(tdir3, uuid3) file(tmp1, 'w').write('pytest') file(tmp2, 'w').write('pytest') os.chmod(tmp1, 0600) os.chmod(tmp2, 0700) assert shell_runner.gather_tests(tdir) == [tmp2] os.remove(tmp1) os.remove(tmp2) os.rmdir(tdir3) os.rmdir(tdir2) os.rmdir(tdir)
def test_gather_tests_single_file_exec(shell_runner): ftmp = tempfile.NamedTemporaryFile(delete=False) os.chmod(ftmp.name, 0700) assert shell_runner.gather_tests(ftmp.name) == ftmp.name ftmp.close() os.remove(ftmp.name)
def test_gather_tests_bad_file(shell_runner): assert shell_runner.gather_tests('/dev/null') is None