def run_command(project='', test_query='', browsers=None, processes=1, environments=None, interactive=False, timestamp=None, reports=None, report_folder=None, report_name=None, tags=None, cli_log_level=None): execution_runner = ExecutionRunner(browsers, processes, environments, interactive, timestamp, reports, report_folder, report_name, tags) if project: if test_directory.project_exists(project): execution_runner.project = project session.settings = settings_manager.get_project_settings(project) # add --interactive value to settings to make # it available from inside a test session.settings['interactive'] = interactive # override cli_log_level setting if provided by the CLI if cli_log_level: session.settings['cli_log_level'] = cli_log_level.upper() if test_query: norm_query = utils.normalize_query(test_query) if suite_module.Suite(project, norm_query).exists: execution_runner.run_suite(norm_query) elif test.Test(project, norm_query).exists: execution_runner.run_test(norm_query) else: if test_query == '.': test_query = '' path = os.path.join(session.testdir, 'projects', project, 'tests', test_query) if os.path.isdir(path): execution_runner.run_directory(test_query) else: msg = ('golem run: error: the value {} does not match ' 'an existing test, suite or directory'.format(test_query)) sys.exit(msg) else: print(messages.RUN_USAGE_MSG) tests = Project(project).test_tree print('Tests:') utils.display_tree_structure_command_line(tests['sub_elements']) suites = Project(project).suite_tree print('\nTest Suites:') # TODO print suites in structure for suite in suites['sub_elements']: print(' ' + suite['name']) else: msg = ('golem run: error: the project {} does not exist'.format(project)) sys.exit(msg) elif interactive: interactive_module.interactive(session.settings, browsers) else: print(messages.RUN_USAGE_MSG) print('Projects:') for project in test_directory.get_projects(): print(' {}'.format(project))
def test_normalize_query_windows(self): assert utils.normalize_query('folder\\suite.py') == 'folder.suite'
def test_normalize_query(self, query, normalized): assert utils.normalize_query(query) == normalized