def main(argv=None): testing_startup.TestInit() if flags.FLAGS.generate: testing_startup.TestInit() ApiRegressionGoldenOutputGenerator(flags.FLAGS.generate).Generate() else: test_lib.main(argv)
def setUpClass(cls): # TODO(hanuszczak): See comment about `TestInit` in `ColabTestMixin`. # Testing startup has to be called before `setUpClass` of the superclass, # because it requires things like the configuration system to be already # initialized. testing_startup.TestInit() super(ColabE2ETest, cls).setUpClass()
def pytest_runtest_setup(item): """A pytest hook that is called before each test item is executed.""" # We need to re-initialize flags (and hence also testing setup) because # various modules might have various flags defined. global last_module if last_module != item.module: flags.Initialize() testing_startup.TestInit() last_module = item.module
def setUpClass(cls) -> None: """Performs all initialization needed to interface with GRR's API.""" # This is a mixin class intended to be used with `absltest.TestCase`. super(ColabTestMixin, cls).setUpClass() # pytype: disable=attribute-error # TODO(hanuszczak): `TestInit` is awful, does a lot of unnecessary stuff and # should be avoided. However, because of all the global state that GRR has # currently, it is extremely hard figure out which parts need initialization # and which do not. Once AFF4 is gone, hopefully this should become much # simpler and `TestInit` will no longer be necessary. testing_startup.TestInit() port = portpicker.pick_unused_port() cls._server_thread = wsgiapp_testlib.ServerThread(port, name="ServerThread") cls._server_thread.StartAndWaitUntilServing() _api._API = api.InitHttp(api_endpoint="http://localhost:{}".format(port)) # pylint: disable=protected-access
def main(argv): """Entry function.""" del argv testing_startup.TestInit() mysql_test.TestMysqlDB.setUpClass() try: # TODO(user): refactor the code to not use protected methods. db, fin = mysql_test.TestMysqlDB._CreateDatabase() # pylint: disable=protected-access try: def _DumpSchema(conn): with contextlib.closing(conn.cursor()) as cursor: return mysql_migration.DumpCurrentSchema(cursor) schema = db._RunInTransaction(_DumpSchema) # pylint: disable=protected-access print(schema) finally: fin() finally: mysql_test.TestMysqlDB.tearDownClass()
def main(argv=None): del argv # Unused. testing_startup.TestInit() absltest.main()
def setUpClass(cls): super(YaraProcessScanTest, cls).setUpClass() testing_startup.TestInit()
def setUpClass(cls): super(GRRBaseTest, cls).setUpClass() with GRRBaseTest._set_up_lock: if not GRRBaseTest._set_up_done: testing_startup.TestInit() GRRBaseTest._set_up_done = True
def setUpClass(cls): super(ApiUploadYaraSignatureHandlerTest, cls).setUpClass() testing_startup.TestInit()
def setUpClass(cls): super(TimelineTest, cls).setUpClass() testing_startup.TestInit()
def setUpClass(cls): super(CronJobRegistryTest, cls).setUpClass() testing_startup.TestInit()
def setUpClass(cls): super().setUpClass() testing_startup.TestInit()
def setUpClass(cls): super(ApiGetCollectedTimelineHandlerTest, cls).setUpClass() testing_startup.TestInit()
def main(argv=None): del argv # Unused. flags.Initialize() testing_startup.TestInit() absltest.main()
def setUpClass(cls): super(CronJobRegistryTest, cls).setUpClass() testing_startup.TestInit() with test_lib.ConfigOverrider({"Server.initialized": True}): server_startup.Init()
def setUpClass(cls): testing_startup.TestInit() super(MySQLYaraTest, cls).setUpClass()