Lines Matching refs:test
24 # Define the basic classes that all test cases are inherited from.
25 # The currently defined test case classes are:
96 # Location of root of test suite.
123 """An exception used to signal that a test was skipped.
126 that some prerequisite of the test is unsatisfied. A string
143 # Version test suite is known to work with.
216 the test case class' debug() method.
246 bogus_url = "test.0.invalid"
620 "ips.test.{0:d}".format(self.__pid), "{0:d}".format(self.ident))
644 # files and dirs inside the test directory rather than
683 # Kill depots before blowing away test dir-- otherwise
805 test prefix path. Additional compiler options should be
806 passed in 'opts'. Suitable for compiling small test
929 # Place inside of test prefix.
963 misc.json_diff("test", je, ja, je, ja)
1030 # test suite.
1105 """Class for passing test results between processes."""
1115 self.errors = [(str(test), err) for test, err in res.errors]
1116 self.failures = [(str(test), err) for test, err in res.failures]
1138 for test, err in errors:
1141 flavour, test))
1147 """Class for combining test results from different test cases."""
1186 def getDescription(self, test):
1187 return str(test)
1197 def dobailout(self, test):
1200 inst, tdf = test.getTeardownFunc()
1207 if getattr(test, "persistent_setup", None):
1209 test.reallytearDown()
1248 def do_archive(self, test, info):
1257 archive_path = os.path.join(archive_path, test.id())
1258 if test.debug_output:
1261 if os.path.exists(test.test_root):
1263 misc.copytree(test.test_root, archive_path)
1267 # If the test has failed without creating its directory,
1274 f.write(test.get_debugbuf())
1280 def addSuccess(self, test):
1281 unittest.TestResult.addSuccess(self, test)
1284 # announced the name of the test, so restate it.
1285 if test.debug_output:
1286 self.statename(test)
1288 errinfo = self.format_output_and_exc(test, None)
1290 bresult = self.baseline.handleresult(str(test), "pass")
1291 expected = self.baseline.expectedresult(str(test))
1311 self.success.append(test)
1314 self.mismatches.append(test)
1317 self.do_archive(test, None)
1322 self.dobailout(test)
1325 def addError(self, test, err):
1331 unittest.TestResult.addError(self, test,
1334 unittest.TestResult.addError(self, test, err)
1337 # announced the name of the test, so restate it.
1338 if test.debug_output:
1339 self.statename(test)
1341 errinfo = self.format_output_and_exc(test, err)
1343 bresult = self.baseline.handleresult(str(test), "error")
1344 expected = self.baseline.expectedresult(str(test))
1384 self.mismatches.append(test)
1388 self.do_archive(test, self._exc_info_to_string(err, test))
1393 self.dobailout(test)
1395 def format_output_and_exc(self, test, error):
1397 dbgbuf = test.get_debugbuf()
1401 res += self._exc_info_to_string(error, test)
1404 def addFailure(self, test, err):
1405 unittest.TestResult.addFailure(self, test, err)
1407 bresult = self.baseline.handleresult(str(test), "fail")
1408 expected = self.baseline.expectedresult(str(test))
1411 # announced the name of the test, so restate it.
1412 if test.debug_output:
1413 self.statename(test)
1415 errinfo = self.format_output_and_exc(test, err)
1446 self.mismatches.append(test)
1450 self.do_archive(test, self._exc_info_to_string(err, test))
1455 self.dobailout(test)
1457 def addSkip(self, test, err):
1460 reason why we wanted to skip this test"""
1461 self.addSuccess(test)
1462 self.skips.append((str(test), err))
1464 def addPersistentSetupError(self, test, err):
1467 errinfo = self.format_output_and_exc(test, err)
1469 res = "# ERROR during persistent setup for {0}\n".format(test.id())
1470 res += "# As a result, all test cases in this class will " \
1480 def addPersistentTeardownError(self, test, err):
1483 errinfo = self.format_output_and_exc(test, err)
1485 res = "# ERROR during persistent teardown for {0}\n".format(test.id())
1493 def statename(self, test, prefix=""):
1494 name = self.getDescription(test)
1503 def startTest(self, test):
1504 unittest.TestResult.startTest(self, test)
1505 test.debug("_" * 75)
1506 test.debug("Start: {0}".format(
1507 self.getDescription(test)))
1508 if test._testMethodDoc is not None:
1510 for x in test._testMethodDoc.splitlines()]
1514 test.debug(x)
1515 test.debug("_" * 75)
1516 test.debug("")
1518 if not test.debug_output:
1519 self.statename(test)
1527 for test, err in errors:
1530 flavour, self.getDescription(test)))
1536 """Find the module and class names for the given test suite."""
1544 """Construct a test result for use in the parallel test suite."""
1553 """Function used to run the test suite in parallel.
1555 The 'inq' parameter is the queue to pull from to get test suites.
1571 # Get the next test suite to run.
1576 # Set up the test so that it plays nicely with tests
1579 # Let the master process know that we have this test
1588 # Build a _Pkg5TestResult object to use for this test.
1614 """TestRunner for test suites that we want to be able to compare
1622 """Set up the test runner"""
1675 # Calculate the new time estimates for each test suite method
1684 # For each test class, find the average time each test in the
1709 # Calculate the average per test, regardless of which test class
1769 # estimate is available, fall back to the average time each test
1771 # is available, fall back to the average time for each test in
1772 # the test suite.
1793 for test in test_map[(mod, c)]:
1797 test.methodName)
1835 print("Total test classes:{0} Finished test "
1851 assumes that test suite is running in its own task which
1860 # Terminated test jobs may have mounted filesystems under their
1869 "ips.test.{0}".format(os.getpid())))
1901 "Run the given test case or test suite."
1914 # test case setUp() may require running pkg commands
1923 for test in t.tests:
1924 tmp = find_names(test)
1926 suite_name = test.suite_name
1928 assert suite_name == test.suite_name
1944 "ips.test.{0}".format(os.getpid())))
2047 self.stream.write("\n# Ran {0:d} test{1} "
2056 for test,reason in result.skips:
2059 test, reason))
2082 "ips.test.{0}".format(os.getpid())))
2090 every test case. Aside from actually running the test it defers the
2093 To make a test class into a persistent one, add this class
2154 "Persistent setUp Failed, skipping test.")
2162 # normal per-test-function teardown.
2182 # every test case to fail.
2188 for test in self._tests:
2191 real_test_name = test._testMethodName
2192 suite_name = test.suite_name
2193 cname = test.__class__.__name__
2196 # Update test environment settings. We redo this
2197 # before running each test case since previously
2198 # executed test cases may have messed with these
2203 # Populate test with the data from the instance
2209 name = test._testMethodName
2210 doc = test._testMethodDoc
2211 buf = test.get_debugbuf()
2219 rtest = test
2227 # If rtest is a copy of test, then we need to copy
2228 # rtest's buffer back to test's so that it has the
2231 test.set_debugbuf(rtest.get_debugbuf())
2301 str = "During this test, a depot Traceback was detected.\n"
2479 prefix = "test"
2904 """A convenient method to cause test execution to pause for
2918 within our test root."""
3675 of the test.
3679 they are registered, which makes the test suite as a whole more
3680 resilient, when setting up and tearing down test classes."""
3725 # test cases.
3928 # SSL reverse-proxying to the pkg.depotd, but allows us to test that pkg(1)
4175 def setUp(self, debug_features=EmptyI, publisher="test",
4196 # for convenience of writing test cases.
4212 def setUp(self, debug_features=EmptyI, publisher="test",
4227 def corrupt_image_create(self, repourl, config, subdirs, prefix="test",
4339 # run from within the test suite.
4360 test_root = os.path.join(g_tempdir, "ips.test.{0:d}".format(os.getpid()))
4380 # apis were invoked. Normally when running the test suite the
4383 # image during a test suite run is verboten. Hence, here we
4489 # up properly when the test completes, which can cause