def pytest_configure(config): """ called after command line options have been parsed and all plugins and initial conftest files been loaded. """ for dirname in CODE_DIR.iterdir(): if not dirname.is_dir(): continue if dirname != TESTS_DIR: config.addinivalue_line("norecursedirs", str(CODE_DIR / dirname)) # Expose the markers we use to pytest CLI config.addinivalue_line( "markers", "requires_salt_modules(*required_module_names): Skip if at least one module is not available.", ) config.addinivalue_line( "markers", "requires_salt_states(*required_state_names): Skip if at least one state module is not available.", ) config.addinivalue_line( "markers", "windows_whitelisted: Mark test as whitelisted to run under Windows" ) config.addinivalue_line( "markers", "requires_sshd_server: Mark test that require an SSH server running" ) # Make sure the test suite "knows" this is a pytest test run RUNTIME_VARS.PYTEST_SESSION = True # "Flag" the slotTest decorator if we're skipping slow tests or not os.environ["SLOW_TESTS"] = str(config.getoption("--run-slow"))
def pytest_configure(config): """ called after command line options have been parsed and all plugins and initial conftest files been loaded. """ for dirname in os.listdir(CODE_DIR): if not os.path.isdir(dirname): continue if dirname != "tests": config.addinivalue_line("norecursedirs", os.path.join(CODE_DIR, dirname)) # Expose the markers we use to pytest CLI config.addinivalue_line( "markers", "requires_salt_modules(*required_module_names): Skip if at least one module is not available.", ) config.addinivalue_line( "markers", "requires_salt_states(*required_state_names): Skip if at least one state module is not available.", ) config.addinivalue_line( "markers", "windows_whitelisted: Mark test as whitelisted to run under Windows") # Make sure the test suite "knows" this is a pytest test run RUNTIME_VARS.PYTEST_SESSION = True
def pytest_configure(config): """ called after command line options have been parsed and all plugins and initial conftest files been loaded. """ for dirname in CODE_DIR.iterdir(): if not dirname.is_dir(): continue if dirname != TESTS_DIR: config.addinivalue_line("norecursedirs", str(CODE_DIR / dirname)) # Expose the markers we use to pytest CLI config.addinivalue_line( "markers", "requires_salt_modules(*required_module_names): Skip if at least one module is not available.", ) config.addinivalue_line( "markers", "requires_salt_states(*required_state_names): Skip if at least one state module is not available.", ) config.addinivalue_line( "markers", "windows_whitelisted: Mark test as whitelisted to run under Windows") # Make sure the test suite "knows" this is a pytest test run RUNTIME_VARS.PYTEST_SESSION = True # "Flag" the slotTest decorator if we're skipping slow tests or not os.environ["SLOW_TESTS"] = str(config.getoption("--run-slow")) # If PyTest has no logging configured, default to ERROR level levels = [logging.ERROR] logging_plugin = config.pluginmanager.get_plugin("logging-plugin") try: level = logging_plugin.log_cli_handler.level if level is not None: levels.append(level) except AttributeError: # PyTest CLI logging not configured pass try: level = logging_plugin.log_file_level if level is not None: levels.append(level) except AttributeError: # PyTest Log File logging not configured pass if logging.NOTSET in levels: # We don't want the NOTSET level on the levels levels.pop(levels.index(logging.NOTSET)) log_level = logging.getLevelName(min(levels)) log_server = LogServer(log_level=log_level) config.pluginmanager.register(log_server, "salt-saltfactories-log-server")
def pytest_configure(config): """ called after command line options have been parsed and all plugins and initial conftest files been loaded. """ for dirname in os.listdir(CODE_DIR): if not os.path.isdir(dirname): continue if dirname != "tests": config.addinivalue_line("norecursedirs", os.path.join(CODE_DIR, dirname)) config.addinivalue_line("norecursedirs", os.path.join(CODE_DIR, "templates")) config.addinivalue_line("norecursedirs", os.path.join(CODE_DIR, "tests/kitchen")) config.addinivalue_line("norecursedirs", os.path.join(CODE_DIR, "tests/support")) # Expose the markers we use to pytest CLI config.addinivalue_line( "markers", "destructive_test: Run destructive tests. These tests can include adding " "or removing users from your system for example.", ) config.addinivalue_line( "markers", "skip_if_not_root: Skip if the current user is not `root`.") config.addinivalue_line( "markers", "skip_if_binaries_missing(*binaries, check_all=False, message=None): Skip if " "any of the passed binaries are not found in path. If 'check_all' is " "'True', then all binaries must be found.", ) config.addinivalue_line( "markers", "requires_network(only_local_network=False): Skip if no networking is set up. " "If 'only_local_network' is 'True', only the local network is checked.", ) config.addinivalue_line( "markers", "requires_salt_modules(*required_module_names): Skip if at least one module is not available. ", ) # Make sure the test suite "knows" this is a pytest test run RUNTIME_VARS.PYTEST_SESSION = True