def pytest_addoption(parser: Parser) -> None: group = parser.getgroup("general") group._addoption( "-k", action="store", dest="keyword", default="", metavar="EXPRESSION", help="only run tests which match the given substring expression. " "An expression is a python evaluatable expression " "where all names are substring-matched against test names " "and their parent classes. Example: -k 'test_method or test_" "other' matches all test functions and classes whose name " "contains 'test_method' or 'test_other', while -k 'not test_method' " "matches those that don't contain 'test_method' in their names. " "-k 'not test_method and not test_other' will eliminate the matches. " "Additionally keywords are matched to classes and functions " "containing extra names in their 'extra_keyword_matches' set, " "as well as functions which have names assigned directly to them. " "The matching is case-insensitive.", ) group._addoption( "-m", action="store", dest="markexpr", default="", metavar="MARKEXPR", help="only run tests matching given mark expression.\n" "For example: -m 'mark1 and not mark2'.", ) group.addoption( "--markers", action="store_true", help="show markers (builtin, plugin and per-project ones).", ) parser.addini("markers", "markers for test functions", "linelist") parser.addini(EMPTY_PARAMETERSET_OPTION, "default marker for empty parametersets")
def pytest_addoption(parser: Parser) -> None: """ This particular suite requires that the router1 host address is informed, as it is used internally in the related inventory files. :param parser: :return: """ parser.addoption("--cluster", action="append", required=True, help="Openshift clusters IP where routers is deployed") parser.addoption( "--token", action="append", required=True, help="Token to authenticate with OCP same order as --cluster") parser.addoption("--msg-length", action="append", required=False, default=[256], help="Message length")
def pytest_addoption(parser: Parser) -> None: group = parser.getgroup("debugconfig") group.addoption( "--assert", action="store", dest="assertmode", choices=("rewrite", "plain"), default="rewrite", metavar="MODE", help=( "Control assertion debugging tools.\n" "'plain' performs no assertion debugging.\n" "'rewrite' (the default) rewrites assert statements in test modules" " on import to provide assert expression information."), ) parser.addini( "enable_assertion_pass_hook", type="bool", default=False, help="Enables the pytest_assertion_pass hook." "Make sure to delete any previously generated pyc cache files.", )
def pytest_addoption(parser: Parser, pluginmanager): """ Adds command line options used by the Seekret plugin. """ _ = pluginmanager # Unused. group = parser.getgroup('seekret') group.addoption('--run-profile', dest='run_profile', type=str, default=None, help='Run profile YAML file to use for the test session')
def pytest_addoption(parser: Parser) -> None: """Turns on emoji parser feature. Args: parser (Parser): cli parser """ group: OptionGroup = parser.getgroup("emoji") group.addoption( "--emoji-out", "--eo", action="store_true", help="Adds emoji to pytest results", )
def pytest_addoption(parser: Parser) -> None: group = parser.getgroup("debugconfig") group.addoption( "--version", "-V", action="count", default=0, dest="version", help="display pytest version and information about plugins." "When given twice, also display information about plugins.", ) group._addoption( "-h", "--help", action=HelpAction, dest="help", help="show help message and configuration info", ) group._addoption( "-p", action="append", dest="plugins", default=[], metavar="name", help= "early-load given plugin module name or entry point (multi-allowed).\n" "To avoid loading of plugins, use the `no:` prefix, e.g. " "`no:doctest`.", ) group.addoption( "--traceconfig", "--trace-config", action="store_true", default=False, help="trace considerations of conftest.py files.", ) group.addoption( "--debug", action="store_true", dest="debug", default=False, help="store internal tracing debug information in 'pytestdebug.log'.", ) group._addoption( "-o", "--override-ini", dest="override_ini", action="append", help= 'override ini option with "option=value" style, e.g. `-o xfail_strict=True -o cache_dir=cache`.', )
def pytest_addoption(parser: Parser) -> None: """Add pytest command line options to configure nuts""" group = parser.getgroup("nuts") # Nornir context specific parameters group.addoption( "--nornir-config", "--nornir-configuration", action="store", dest="nornir_configuration", default=NornirNutsContext.DEFAULT_NORNIR_CONFIG_FILE, metavar="NORNIR_CONFIG", help="nuts nornir configuration file. Default is nr-config.yaml", )
def pytest_addoption(parser: Parser): xray = parser.getgroup('Jira Xray report') xray.addoption(JIRA_XRAY_FLAG, action='store_true', default=False, help='Upload test results to JIRA XRAY') xray.addoption(JIRA_CLOUD, action='store_true', default=False, help='Use with JIRA XRAY could server') xray.addoption( JIRA_API_KEY, action='store_true', default=False, help='Use API Key authentication', ) xray.addoption( JIRA_TOKEN, action='store_true', default=False, help='Use token authentication', ) xray.addoption( JIRA_CLIENT_SECRET_AUTH, action='store_true', default=False, help='Use client secret authentication', ) xray.addoption(XRAY_EXECUTION_ID, action='store', metavar='ExecutionId', default=None, help='XRAY Test Execution ID') xray.addoption(XRAY_TEST_PLAN_ID, action='store', metavar='TestplanId', default=None, help='XRAY Test Plan ID') xray.addoption( XRAYPATH, action='store', metavar='path', default=None, help= 'Do not upload to a server but create JSON report file at given path') xray.addoption( XRAY_ALLOW_DUPLICATE_IDS, action='store_true', default=False, help='Allow test ids to be present on multiple pytest tests')
def pytest_addoption(parser: Parser) -> None: group = parser.getgroup("debugconfig") group.addoption( "--setuponly", "--setup-only", action="store_true", help="only setup fixtures, do not execute tests.", ) group.addoption( "--setupshow", "--setup-show", action="store_true", help="show setup of fixtures while executing tests.", )
def pytest_addoption(parser: Parser) -> None: """Add options to control ansible.""" log.debug('pytest_addoption() called') group: OptionGroup = parser.getgroup('pytest-iqa') group.addoption( '--inventory', action='store', dest='inventory', required=True, metavar='INVENTORY', help='Inventory file to use', ) # Default values for pytest.ini files (if absent) parser.addini( 'log_level', default='WARNING', type=None, help='logging level used by the logging module', ) parser.addini( 'log_format', default=DEFAULT_LOG_FORMAT, type=None, help='log format as used by the logging module.', ) parser.addini( 'log_date_format', default=DEFAULT_LOG_DATE_FORMAT, type=None, help='log date format as used by the logging module.', ) parser.addini( 'log_cli', default=True, type='bool', help='enable log display during test run (also known as "live logging").', )
def test_parse_split_positional_arguments(self, parser: parseopt.Parser) -> None: parser.addoption("-R", action="store_true") parser.addoption("-S", action="store_false") args = parser.parse(["-R", "4", "2", "-S"]) assert getattr(args, parseopt.FILE_OR_DIR) == ["4", "2"] args = parser.parse(["-R", "-S", "4", "2", "-R"]) assert getattr(args, parseopt.FILE_OR_DIR) == ["4", "2"] assert args.R is True assert args.S is False args = parser.parse(["-R", "4", "-S", "2"]) assert getattr(args, parseopt.FILE_OR_DIR) == ["4", "2"] assert args.R is True assert args.S is False
def pytest_addoption(parser: Parser) -> None: group = parser.getgroup("general") group.addoption( "--sw", "--stepwise", action="store_true", dest="stepwise", help= "exit on test failure and continue from last failing test next time", ) group.addoption( "--stepwise-skip", action="store_true", dest="stepwise_skip", help="ignore the first failing test but stop on the next failing test", )
def pytest_addoption(parser: Parser) -> None: group = parser.getgroup("factoryboy-state") group.addoption( "--show-state", action="store_true", dest="show_state", default=False, help="Show factoryboy state for failures.", ) group.addoption( "--set-state", action="store", dest="factoryboy_state", default=None, help="Set factoryboy state.", )
def pytest_addoption(parser: Parser) -> None: """Registers argparse-style options for Compara's unit testing. `Pytest initialisation hook <https://docs.pytest.org/en/latest/reference.html#_pytest.hookspec.pytest_addoption>`_. Args: parser: Parser for command line arguments and ini-file values. """ # Add the Compara unitary test parameters to pytest parser group = parser.getgroup("compara unit testing") group.addoption('--server', action='store', metavar='URL', dest='server', required=True, help="URL to the server where to create the test database(s).") group.addoption('--keep-data', action='store_true', dest='keep_data', help="Do not remove test databases/temporary directories. Default: False")
def pytest_addoption(parser: Parser) -> None: parser.addoption("--master-config-path", action="store", default=None, help="Path to master config path") parser.addoption( "--master-host", action="store", default="localhost", help="Master host for integration tests", ) parser.addoption("--master-port", action="store", default="8080", help="Master port for integration tests") parser.addoption("--require-secrets", action="store_true", help="fail tests when s3 access fails")
def pytest_addoption(parser: Parser) -> None: group = parser.getgroup("mypy-tests") group.addoption( "--mypy-testing-base", type=str, default=tempfile.gettempdir(), help="Base directory for tests to use" ) group.addoption("--mypy-ini-file", type=str, help="Which .ini file to use as a default config for tests") group.addoption( "--mypy-same-process", action="store_true", help="Run in the same process. Useful for debugging, will create problems with import cache", ) group.addoption( "--mypy-extension-hook", type=str, help="Fully qualifield path to the extension hook function, in case you need custom yaml keys. " "Has to be top-level.", )
def pytest_addoption(parser: Parser) -> None: group = parser.getgroup("general") group._addoption( "--capture", action="store", default="fd", metavar="method", choices=["fd", "sys", "no", "tee-sys"], help="per-test capturing method: one of fd|sys|no|tee-sys.", ) group._addoption( "-s", action="store_const", const="no", dest="capture", help="shortcut for --capture=no.", )
def pytest_addoption(parser: Parser) -> None: """Register argparse-style options for Compara's unitary testing.""" # Load default host information with open(Path(__file__).parent / 'default_host.json') as f: host = json.load(f) # If password starts with '$', treat it as an environment variable that needs to be resolved if host['password'].startswith('$'): host['password'] = os.environ[host['password'][1:]] # Add the Compara unitary test parameters to pytest parser group = parser.getgroup("compara unitary test") group.addoption( '--server', action='store', metavar='URL', dest='server', default=str(sqlalchemy.engine.url.URL(**host)), help="URL to the server where to create the test database(s)")
def pytest_addoption(parser: Parser) -> None: group = parser.getgroup("terminal reporting", "reporting", after="general") group.addoption( "--durations", action="store", type=int, default=None, metavar="N", help="show N slowest setup/test durations (N=0 for all).", ) group.addoption( "--durations-min", action="store", type=float, default=0.005, metavar="N", help="Minimal duration in seconds for inclusion in slowest list. Default 0.005", )
def pytest_addoption(parser: Parser) -> None: group = parser.getgroup("general") group.addoption( "--print-relative-time", action="store_true", dest="pytest_print_relative_time", default=False, help= "Time in milliseconds when the print was invoked, relative to the time the fixture was created.", ) group.addoption( "--print", action="store_true", dest="pytest_print_on", default=False, help= "By default the plugins if verbosity is greater than zero (-v flag), this forces on", )
def pytest_addoption(parser: Parser, pluginmanager: PytestPluginManager) -> None: group = parser.getgroup("terminal reporting") group.addoption( f"--pdf", dest=Option.PDF, action="store", default=None, required=False, help="create pdf report file at given path", ) group.addoption( f"--pdf-short", dest=Option.PDF_SHORT, action="store_true", default=False, required=False, help="lists failed test steps only in test report", )
def pytest_addoption(parser: Parser) -> None: """Register pytest flags""" group = parser.getgroup("pytest-rts") group.addoption("--rts", action="store_true", default=False, help="Run pytest-rts") group.addoption( "--rts-coverage-db", action="store", default="", help="Coverage file for pytest-rts", ) group.addoption( "--rts-from-commit", action="store", default="", help="Give a comparison Git commithash for RTS", )
def pytest_addoption(parser: Parser) -> None: """ Add messaging options to py.test runner """ components: OptionGroup = parser.getgroup('iqa-messaging_components') # Senders components.addoption("--sender", action="append", default=[], help="Define sender client [native, nodejs]") # Brokers components.addoption("--receiver", action="append", default=[], help="Define receiver client []") # Routers components.addoption("--router", action="append", default=[], help="Define which router [dispatch, interconnect]") # Brokers components.addoption("--broker", action="append", default=[], help="Define which broker [amq7, artemis, rabitmq]") # TLS components.addoption("--tls", action="append", default=[], help="TLS option [tls10,tls11,tls12,tls13]")
def pytest_addoption(parser: Parser) -> None: """Defines custom pytest options. Args: parser: Parser for command line arguments and ini-file values """ group: OptionGroup = parser.getgroup(name='Confluence test report') group.addoption( '--confluence-upload', '--cu', action='store_true', help='Convert pytest results into Confluence page', ) group.addoption( '--confluence-settings', '--cs', type=str, default=SETTINGS_PATH, help=f'Path to Confluence settings file e.g `{SETTINGS_PATH}`.', )
def pytest_addoption(parser: Parser) -> None: group = parser.getgroup("pyppeteer") group.addoption("--executable-path", default=None, help="Path to a Chromium or Chrome executable.") group.addoption("--headless", action="store_true", help="Run browser in headless mode.") group.addoption("--args", action="append", nargs="+", default=list(), help="Additional args passed to the browser.") group.addoption("--window-size", nargs=2, default=["800", "600"], help="Set the initial browser window size.") group.addoption("--slow", type=float, default=0.0, help="Slow down the operate in milliseconds.")
def pytest_addoption(parser: Parser) -> None: group = parser.getgroup("general") group._addoption( "--pdb", dest="usepdb", action="store_true", help="start the interactive Python debugger on errors or KeyboardInterrupt.", ) group._addoption( "--pdbcls", dest="usepdb_cls", metavar="modulename:classname", type=_validate_usepdb_cls, help="start a custom interactive Python debugger on errors. " "For example: --pdbcls=IPython.terminal.debugger:TerminalPdb", ) group._addoption( "--trace", dest="trace", action="store_true", help="Immediately break when running each testCases.", )
def pytest_addoption(parser: Parser) -> None: group = parser.getgroup('mypy-tests') group.addoption('--mypy-testing-base', type=str, default=tempfile.gettempdir(), help='Base directory for tests to use') group.addoption( '--mypy-ini-file', type=str, help='Which .ini file to use as a default config for tests') group.addoption( '--mypy-same-process', action='store_true', help= 'Run in the same process. Useful for debugging, will create problems with import cache' ) group.addoption( '--mypy-extension-hook', type=str, help= 'Fully qualifield path to the extension hook function, in case you need custom yaml keys. ' 'Has to be top-level.')
def tgn_pytest_addoption(parser: Parser, tgn_config: str) -> None: """Add options to allow the user to determine which APIs and servers to test. :param parser: pytest parser to config. :param tgn_config: Full path to test configuration module. """ if Path(tgn_config).exists(): test_config = get_test_config(tgn_config) tgn_api = test_config.api tgn_server = test_config.server else: tgn_api = None tgn_server = None tgn_config = None parser.addoption("--tgn-api", action="append", default=tgn_api, help="api options: rest or tcl, where applicable") parser.addoption("--tgn-server", action="append", default=tgn_server, help="server name in the configuration file") parser.addoption("--tgn-config", action="store", default=tgn_config, help="path to configuration file")
def pytest_addoption(parser: Parser) -> None: """Registers argparse-style options for CITest.""" group = parser.getgroup("continuous integration test (citest)") group.addoption('--reference-db', action='store', metavar='URL', dest='reference_db', help="URL to reference database") group.addoption('--reference-dir', action='store', metavar='PATH', dest='reference_dir', help="Path to reference root directory") group.addoption('--target-db', action='store', metavar='URL', dest='target_db', help="URL to target database") group.addoption('--target-dir', action='store', metavar='PATH', dest='target_dir', help="Path to target root directory")
def pytest_addoption(parser: Parser) -> None: parser.addoption( "--postgres-url", dest="postgres_url", help="Postgres override connection string", metavar="postgres://*****:*****@host:port/dbname", ) parser.addoption( "--rabbit-url", dest="rabbit_url", help="RabbitMq override connection string", metavar="amqp://*****:*****@host:port/vhost", ) parser.addoption( "--redis-url", dest="redis_url", help="Redis override connection string", metavar="redis://host:port/db", )