def process_execution_starting_request(request, clear=True): if clear: registry.clear() load_impls(get_step_impl_dirs()) execution_info = create_execution_context_from( request.currentExecutionInfo) response = run_hook(request, registry.before_suite(), execution_info) _add_message_and_screenshots(response) return response
def _execute_before_suite_hook(request, response, _socket, clear=True): if clear: registry.clear() load_impls(get_step_impl_dir()) if environ.get('DEBUGGING'): ptvsd.enable_attach('', address=('0.0.0.0', int(environ.get('DEBUG_PORT')))) logging.info(ATTACH_DEBUGGER_EVENT) ptvsd.wait_for_attach() execution_info = create_execution_context_from( request.executionStartingRequest.currentExecutionInfo) run_hook(request, response, registry.before_suite(), execution_info)
def _execute_before_suite_hook(request, response, _socket, clear=True): if clear: registry.clear() load_impls(get_step_impl_dir()) if environ.get('DEBUGGING'): ptvsd.enable_attach('', address=('127.0.0.1', int(environ.get('DEBUG_PORT')))) logging.info(ATTACH_DEBUGGER_EVENT) t = Timer(int(environ.get("debugger_wait_time", 30)), handle_detached) t.start() ptvsd.wait_for_attach() t.cancel() execution_info = create_execution_context_from(request.executionStartingRequest.currentExecutionInfo) run_hook(request, response, registry.before_suite(), execution_info) response.executionStatusResponse.executionResult.message.extend(MessagesStore.pending_messages())
def _execute_before_suite_hook(request, response, _socket, clear=True): if clear: registry.clear() load_impls(get_step_impl_dir()) if environ.get('DEBUGGING'): ptvsd.enable_attach('', address=('127.0.0.1', int(environ.get('DEBUG_PORT')))) logging.info(ATTACH_DEBUGGER_EVENT) signal.signal(signal.SIGALRM, handle_detached) signal.alarm(int(environ.get("debugger_wait_time", 30))) ptvsd.wait_for_attach() execution_info = create_execution_context_from( request.executionStartingRequest.currentExecutionInfo) run_hook(request, response, registry.before_suite(), execution_info)
def tearDown(self): registry.clear()
def setUp(self): self.setUpPyfakefs() data_store.suite.clear() data_store.spec.clear() data_store.scenario.clear() registry.clear()
from unittest import TestCase, main from getgauge.messages.messages_pb2 import Message from getgauge.registry import registry, MessagesStore from getgauge.python import (Messages, DataStore, DataStoreFactory, Table, Specification, Scenario, Step, ExecutionContext, create_execution_context_from) registry.clear() class MessagesTests(TestCase): def test_pending_messages(self): messages = ['HAHAHAH', 'HAHAHAH1', 'HAHAHAH2', 'HAHAHAH3'] for message in messages: Messages.write_message(message) pending_messages = MessagesStore.pending_messages() self.assertEqual(messages, pending_messages) def test_clear(self): messages = ['HAHAHAH', 'HAHAHAH1', 'HAHAHAH2', 'HAHAHAH3'] for message in messages: Messages.write_message(message) MessagesStore.clear() pending_messages = MessagesStore.pending_messages() self.assertEqual([], pending_messages) def test_pending_messages_gives_only_those_messages_which_are_not_reported( self): messages = ['HAHAHAH', 'HAHAHAH1', 'HAHAHAH2', 'HAHAHAH3'] for message in messages:
import unittest from getgauge.messages.messages_pb2 import Message from getgauge.python import Messages, DataStore, DataStoreFactory, Table, Specification, Scenario, Step, \ ExecutionContext, \ create_execution_context_from from getgauge.registry import registry, _MessagesStore registry.clear() class MessagesTests(unittest.TestCase): def test_pending_messages(self): messages = ['HAHAHAH', 'HAHAHAH1', 'HAHAHAH2', 'HAHAHAH3'] for message in messages: Messages.write_message(message) pending_messages = _MessagesStore.pending_messages() self.assertEqual(messages, pending_messages) def test_clear(self): messages = ['HAHAHAH', 'HAHAHAH1', 'HAHAHAH2', 'HAHAHAH3'] for message in messages: Messages.write_message(message) _MessagesStore.clear() pending_messages = _MessagesStore.pending_messages() self.assertEqual([], pending_messages) def test_pending_messages_gives_only_those_messages_which_are_not_reported(self): messages = ['HAHAHAH', 'HAHAHAH1', 'HAHAHAH2', 'HAHAHAH3'] for message in messages: Messages.write_message(message)
def setUp(self): self.setUpPyfakefs() DataStoreFactory.suite_data_store().clear() DataStoreFactory.spec_data_store().clear() DataStoreFactory.scenario_data_store().clear() registry.clear()
def setUp(self): registry.clear()
def setUp(self): registry.clear() self.setUpPyfakefs()
def setUp(self): DataStoreFactory.suite_data_store().clear() DataStoreFactory.spec_data_store().clear() DataStoreFactory.scenario_data_store().clear() registry.clear()