How to use the unittest2.TestCase.setUp function in unittest2

To help you get started, we’ve selected a few unittest2 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 wingify / agentredrabbit / tests / transport_tests.py View on Github external
def setUp(self):
        """
        Creates a Transporter object
        Mocks Redis, channel, schedule_next_message and basic_publish
        """
        unittest.TestCase.setUp(self)
        self.transporter = transport.Transporter("1", threading.Lock(),
                                                 config.ReadConfig(),
                                                 "queue1", threading.Event())
        self.transporter.stopping = False
        self.test_message = "{'key1': 'value1', 'key2': 'value2'}"

        self.transporter.redis = Mock()
        self.transporter.redis.chunk_pop.return_value = ([self.test_message]*8,
                                                         False)
        self.transporter.channel = Mock()
        self.transporter.channel.basic_publish = mock_publish
        self.transporter.schedule_next_message = Mock(return_value=None)
github datasift / datasift-python / tests / test_client.py View on Github external
def setUp(self):
        TestCase.setUp(self)
        self.client = Client("testuser", "testapikey")
github splunk / splunk-sdk-python / tests / searchcommands / test_searchcommands_app.py View on Github external
def setUp(self):
        if not os.path.isdir(TestSearchCommandsApp.app_root):
            build_command = os.path.join(project_root, 'examples', 'searchcommands_app', 'setup.py build')
            self.skipTest("You must build the searchcommands_app by running " + build_command)
        TestCase.setUp(self)
github aliyun / alibabacloud-python-sdk-v2 / python-function-test / base.py View on Github external
def setUp(self):
        TestCase.setUp(self)
        self.client_config = self.init_client_config()
github splunk / splunk-sdk-python / tests / testlib.py View on Github external
def setUp(self):
        unittest.TestCase.setUp(self)
        self.service = client.connect(**self.opts.kwargs)
        # If Splunk is in a state requiring restart, go ahead
        # and restart. That way we'll be sane for the rest of
        # the test.
        if self.service.restart_required:
            self.restartSplunk()
        logging.debug("Connected to splunkd version %s", '.'.join(str(x) for x in self.service.splunk_version))
github datasift / datasift-python / tests / test_client.py View on Github external
def setUp(self):
        TestCase.setUp(self)
        self.client = Client("testuser", "testapikey")
github datasift / datasift-python / tests / test_client.py View on Github external
def setUp(self):
        TestCase.setUp(self)
        self.client = Client("testuser", "testapikey")