How to use _find_parent_directory method in toolium

Best Python code snippet using toolium_python

driver_wrappers_pool.py

Source:driver_wrappers_pool.py Github

copy

Full Screen

...235 config_directory = cls.get_configured_value('TOOLIUM_CONFIG_DIRECTORY', 'Config_directory',236 tc_config_files.config_directory, 'conf')237 prop_filenames = cls.get_configured_value('TOOLIUM_CONFIG_PROPERTIES_FILENAMES', 'Config_prop_filenames',238 tc_config_files.config_properties_filenames, 'properties.cfg')239 cls.config_directory = cls._find_parent_directory(config_directory, prop_filenames.split(';')[0])240 # Get output directory from properties and create it241 cls.output_directory = cls.get_configured_value('TOOLIUM_OUTPUT_DIRECTORY', 'Output_directory',242 tc_config_files.output_directory, 'output')243 if not os.path.isabs(cls.output_directory):244 # If output directory is relative, we use the same path as config directory245 cls.output_directory = os.path.join(os.path.dirname(cls.config_directory), cls.output_directory)246 makedirs_safe(cls.output_directory)247 # Get visual baseline directory from properties248 default_baseline = os.path.join(cls.output_directory, 'visualtests', 'baseline')249 cls.visual_baseline_directory = cls.get_configured_value('TOOLIUM_VISUAL_BASELINE_DIRECTORY',250 'Visual_baseline_directory',251 tc_config_files.visual_baseline_directory,252 default_baseline)253 if not os.path.isabs(cls.visual_baseline_directory):254 # If baseline directory is relative, we use the same path as config directory255 cls.visual_baseline_directory = os.path.join(os.path.dirname(cls.config_directory),256 cls.visual_baseline_directory)257 @staticmethod258 def get_default_config_directory():259 """Return default config directory, based in the actual test path260 :returns: default config directory261 """262 test_path = os.path.dirname(os.path.realpath(inspect.getouterframes(inspect.currentframe())[2][1]))263 return os.path.join(test_path, 'conf')264 @staticmethod265 def _find_parent_directory(directory, filename):266 """Find a directory in parent tree with a specific filename267 :param directory: directory name to find268 :param filename: filename to find269 :returns: absolute directory path270 """271 parent_directory = directory272 absolute_directory = '.'273 while absolute_directory != os.path.abspath(parent_directory):274 absolute_directory = os.path.abspath(parent_directory)275 if os.path.isfile(os.path.join(absolute_directory, filename)):276 return absolute_directory277 if os.path.isabs(parent_directory):278 parent_directory = os.path.join(os.path.dirname(parent_directory), '..',279 os.path.basename(parent_directory))...

Full Screen

Full Screen

driver_manager.py

Source:driver_manager.py Github

copy

Full Screen

...143 config_directory = cls.get_configured_value('Config_directory', tc_config_files.config_directory, 'conf')144 prop_filenames = cls.get_configured_value('Config_prop_filenames',145 tc_config_files.config_properties_filenames,146 'properties.cfg')147 cls.config_directory = cls._find_parent_directory(config_directory, prop_filenames.split(';')[0])148 cls.output_directory = cls.get_configured_value('Output_directory',149 tc_config_files.output_directory,150 'output')151 if not os.path.isabs(cls.output_directory):152 cls.output_directory = os.path.join(os.path.dirname(cls.config_directory), cls.output_directory)153 if not os.path.exists(cls.output_directory):154 os.makedirs(cls.output_directory)155 default_baseline = os.path.join(cls.output_directory, 'visualtests', 'baseline')156 cls.visual_baseline_directory = cls.get_configured_value('Visual_baseline_directory',157 tc_config_files.visual_baseline_directory,158 default_baseline)159 if not os.path.isabs(cls.visual_baseline_directory):160 cls.visual_baseline_directory = os.path.join(os.path.dirname(cls.config_directory),161 cls.visual_baseline_directory)162 @staticmethod163 def get_default_config_directory():164 test_path = os.path.abspath("settings")165 return os.path.join(test_path, 'conf')166 @staticmethod167 def _find_parent_directory(directory, filename):168 parent_directory = directory169 absolute_directory = '.'170 while absolute_directory != os.path.abspath(parent_directory):171 absolute_directory = os.path.abspath(parent_directory)172 if os.path.isfile(os.path.join(absolute_directory, filename)):173 return absolute_directory174 if os.path.isabs(parent_directory):175 parent_directory = os.path.join(os.path.dirname(parent_directory), '../..',176 os.path.basename(parent_directory))177 else:178 parent_directory = os.path.join('../..', parent_directory)179 return os.path.abspath(directory)180 @classmethod181 def configure_visual_directories(cls, driver_info):...

Full Screen

Full Screen

test_driver_wrappers_pool.py

Source:test_driver_wrappers_pool.py Github

copy

Full Screen

...90def test_find_parent_directory_relative():91 directory = 'conf'92 filename = 'properties.cfg'93 expected_config_directory = os.path.join(os.getcwd(), 'conf')94 assert expected_config_directory == DriverWrappersPool._find_parent_directory(directory, filename)95def test_find_parent_directory_file_not_found():96 directory = 'conf'97 filename = 'unknown'98 expected_config_directory = os.path.join(os.getcwd(), 'conf')99 assert expected_config_directory == DriverWrappersPool._find_parent_directory(directory, filename)100def test_find_parent_directory_absolute():101 directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'conf')102 filename = 'properties.cfg'103 expected_config_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'conf')104 assert expected_config_directory == DriverWrappersPool._find_parent_directory(directory, filename)105def test_find_parent_directory_absolute_recursively():106 directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'unknown', 'conf')107 filename = 'properties.cfg'108 expected_config_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'conf')109 assert expected_config_directory == DriverWrappersPool._find_parent_directory(directory, filename)110def test_initialize_config_files_new():111 config_files = None112 # Initialize config files113 init_config_files = DriverWrappersPool.initialize_config_files(config_files)114 # Check expected config files115 assert init_config_files.config_properties_filenames is None116 assert init_config_files.output_log_filename is None117def test_initialize_config_files_new_environment():118 config_files = None119 os.environ['TOOLIUM_CONFIG_ENVIRONMENT'] = 'android'120 # Initialize config files121 config_files = DriverWrappersPool.initialize_config_files(config_files)122 del os.environ['TOOLIUM_CONFIG_ENVIRONMENT']123 # Check expected config files...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run toolium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful