def driver_wrapper(): # Remove previous visual path root_path = os.path.dirname(os.path.realpath(__file__)) visual_path = os.path.join(root_path, 'output', 'visualtests') if os.path.exists(visual_path): shutil.rmtree(visual_path) # Reset wrappers pool values DriverWrappersPool._empty_pool() DriverWrapper.config_properties_filenames = None # Create a new wrapper driver_wrapper = DriverWrappersPool.get_default_wrapper() driver_wrapper.driver = mock.MagicMock() # Configure properties root_path = os.path.dirname(os.path.realpath(__file__)) config_files = ConfigFiles() config_files.set_config_directory(os.path.join(root_path, 'conf')) config_files.set_config_properties_filenames('properties.cfg') config_files.set_output_directory(os.path.join(root_path, 'output')) driver_wrapper.configure(config_files) driver_wrapper.config.set('VisualTests', 'enabled', 'true') yield driver_wrapper # Remove visual path visual_path = os.path.join(root_path, 'output', 'visualtests') if os.path.exists(visual_path): shutil.rmtree(visual_path) # Reset wrappers pool values DriverWrappersPool._empty_pool() DriverWrapper.config_properties_filenames = None
def setUp(self): # Remove previous visual path visual_path = os.path.join(self.root_path, 'output', 'visualtests') if os.path.exists(visual_path): shutil.rmtree(visual_path) # Reset wrappers pool values DriverWrappersPool._empty_pool() DriverWrapper.config_properties_filenames = None # Create a new wrapper self.driver_wrapper = DriverWrappersPool.get_default_wrapper() self.driver_wrapper.driver = mock.MagicMock() # Configure properties config_files = ConfigFiles() config_files.set_config_directory(os.path.join(self.root_path, 'conf')) config_files.set_config_properties_filenames('properties.cfg') config_files.set_output_directory( os.path.join(self.root_path, 'output')) self.driver_wrapper.configure(tc_config_files=config_files) self.driver_wrapper.config.set('VisualTests', 'enabled', 'true') # Create a new VisualTest instance self.visual = VisualTest(self.driver_wrapper)
def tearDownClass(cls): # Remove visual path visual_path = os.path.join(cls.root_path, 'output', 'visualtests') if os.path.exists(visual_path): shutil.rmtree(visual_path) # Reset wrappers pool values DriverWrappersPool._empty_pool() DriverWrapper.config_properties_filenames = None
def setUp(self): # Remove previous visual path visual_path = os.path.join(self.root_path, 'output', 'visualtests') if os.path.exists(visual_path): shutil.rmtree(visual_path) # Reset wrappers pool values DriverWrappersPool._empty_pool() DriverWrapper.config_properties_filenames = None # Create a new wrapper self.driver_wrapper = DriverWrappersPool.get_default_wrapper() self.driver_wrapper.driver = mock.MagicMock() # Configure properties config_files = ConfigFiles() config_files.set_config_directory(os.path.join(self.root_path, 'conf')) config_files.set_config_properties_filenames('properties.cfg') config_files.set_output_directory(os.path.join(self.root_path, 'output')) self.driver_wrapper.configure(tc_config_files=config_files) self.driver_wrapper.config.set('VisualTests', 'enabled', 'true') # Create a new VisualTest instance self.visual = VisualTest(self.driver_wrapper)