How to use the mock.patch.stopall function in mock

To help you get started, we’ve selected a few mock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ocadotechnology / bbq / tests / retention / test_table_retention_handler.py View on Github external
def tearDown(self):
        self.testbed.deactivate()
        patch.stopall()
github frictionlessdata / tableschema-py / tests / test_pushpull.py View on Github external
def setUp(self):
        self.addCleanup(patch.stopall)
        self.csv = patch.object(module, 'csv').start()
        self.json = patch.object(module, 'json').start()
        self.Stream = patch.object(module, 'Stream').start()
        self.open = patch.object(module.io, 'open').start()
        self.ensure_dir = patch.object(module.helpers, 'ensure_dir').start()
        self.SchemaModel = patch.object(module, 'SchemaModel').start()
        self.import_module = patch.object(module, 'import_module').start()
        self.storage = self.import_module.return_value.Storage.return_value
        self.backend_options = {}
github pierky / arouteserver / tests / live_tests / base.py View on Github external
def _tearDownClass(cls):
        mock.patch.stopall()

        if cls._do_not_run_instances():
            return

        if cls._do_not_stop_instances():
            cls.debug("Skipping instances stopping")
            return

        print("{}: stopping instances...".format(cls.SHORT_DESCR))

        for instance in cls.INSTANCES:
            cls.debug("Stopping instance '{}'...".format(instance.name))
            instance.stop()
github koji-project / koji / tests / test_cli / test_activate_session.py View on Github external
def tearDown(self):
        mock.patch.stopall()
        shutil.rmtree(self.tempdir)
github pierky / ripe-atlas-monitor / tests / base.py View on Github external
def tearDown(self):
        if not self.ip_cache_mocked:
            self.ip_cache.save()
        mock.patch.stopall()