Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _assert_flaky_plugin_configured(self):
options = Mock()
options.multiprocess_workers = 0
conf = Mock()
self._flaky_plugin.enabled = True
with patch.object(flaky_nose_plugin, 'TextTestResult') as flaky_result:
flaky_result.return_value = self._mock_test_result
from io import StringIO
self._mock_stream = MagicMock(spec=StringIO)
with patch.object(self._flaky_plugin, '_get_stream') as get_stream:
get_stream.return_value = self._mock_stream
self._flaky_plugin.configure(options, conf)
def setUp(self):
super(TestFlakyNosePlugin, self).setUp()
self._mock_test_result = MagicMock()
self._mock_stream = None
self._flaky_plugin = flaky_nose_plugin.FlakyPlugin()
self._mock_nose_result = Mock(flaky_nose_plugin.TextTestResult)
self._flaky_plugin.prepareTestResult(self._mock_nose_result)
self._mock_test = MagicMock(name='flaky_plugin_test')
self._mock_test_case = MagicMock(
name='flaky_plugin_test_case',
spec=TestCase
)
self._mock_test_case.address = MagicMock()
self._mock_test_case.test = self._mock_test
self._mock_test_module_name = 'test_module'
self._mock_test_class_name = 'TestClass'
self._mock_test_method_name = 'test_method'
self._mock_test_names = '{}:{}.{}'.format(
self._mock_test_module_name,
self._mock_test_class_name,
self._mock_test_method_name
)