def test_regular_file(self): (fd, p) = tempfile.mkstemp() self.addCleanup(os.remove, p) f = os.fdopen(fd, 'w') try: f.write('noise\n-- TEST --\ndata\nenv\ncmd\n') finally: f.close() outf = StringIO() self.assertEquals([('data', 'env', 'cmd', None)], list(read_testlist_file(p, outf))) self.assertEquals("noise\n", outf.getvalue())
def test_regular_file(self): (fd, p) = tempfile.mkstemp() self.addCleanup(os.remove, p) f = os.fdopen(fd, 'w') try: f.write('noise\n-- TEST --\ndata\nenv\ncmd\n') finally: f.close() outf = StringIO() self.assertEquals( [('data', 'env', 'cmd', None)], list(read_testlist_file(p, outf))) self.assertEquals("noise\n", outf.getvalue())
os.environ["SELFTEST_TMPDIR"] = tmpdir_abs os.environ["TEST_DATA_PREFIX"] = tmpdir_abs if opts.socket_wrapper: os.environ["SELFTEST_INTERFACES"] = interfaces else: os.environ["SELFTEST_INTERFACES"] = "" if opts.quick: os.environ["SELFTEST_QUICK"] = "1" else: os.environ["SELFTEST_QUICK"] = "" os.environ["SELFTEST_MAXTIME"] = str(torture_maxtime) available = [] for fn in opts.testlist: for testsuite in testlist.read_testlist_file(fn): if not testlist.should_run_test(tests, testsuite): continue name = testsuite[0] if (includes is not None and testlist.find_in_list(includes, name) is not None): continue available.append(testsuite) if opts.load_list: restricted_mgr = testlist.RestrictedTestManager.from_path(opts.load_list) else: restricted_mgr = None for testsuite in available: name = testsuite[0]