Beispiel #1
0
def pytest_addoption(parser: Parser, pluginmanager: PytestPluginManager):
    parser.addoption(
        "--offline",
        action="store_true",
        default=False,
        help="test run will not have an internet connection",
    )
Beispiel #2
0
def pytest_addoption(parser: Parser, pluginmanager: PytestPluginManager):
    parser.addoption(
        "--ignore-fixture-conflicts",
        action="store_true",
        help=
        "When enabled, allows multiple fixture definitions to exist for a single fixture name.",
    )
Beispiel #3
0
def pytest_addoption(parser: Parser):
    parser.addoption(
        "--iaas",
        action="store",
        default="gcp",
        help="Infrastructure the tests should run on",
    )
Beispiel #4
0
def pytest_addoption(parser: Parser) -> None:
    parser.addoption(
        "--keep-tmpdir",
        action="store_true",
        default=False,
        help="keep temporary test directories",
    )
    parser.addoption(
        "--resolver",
        action="store",
        default="2020-resolver",
        choices=["2020-resolver", "legacy"],
        help="use given resolver in tests",
    )
    parser.addoption(
        "--use-venv",
        action="store_true",
        default=False,
        help="use venv for virtual environment creation",
    )
    parser.addoption(
        "--run-search",
        action="store_true",
        default=False,
        help="run 'pip search' tests",
    )
    parser.addoption(
        "--proxy",
        action="store",
        default=None,
        help="use given proxy in session network tests",
    )
Beispiel #5
0
def pytest_addoption(parser: Parser) -> None:
    parser.addoption(
        "--headed",
        dest="headed",
        action="store_true",
        help="Open a browser window when runnging web-based tests",
    )
Beispiel #6
0
def pytest_addoption(parser: Parser) -> None:
    parser.addoption(
        "--lint-only",
        action="store_true",
        default=False,
        help="Only run linting checks",
    )
Beispiel #7
0
def pytest_addoption(parser: Parser) -> None:
    parser.addoption("--startup-timeout",
                     type=int,
                     action="store",
                     default=60 * 30,
                     help="timeout in seconds for starting a node")
    parser.addoption("--converge-timeout",
                     type=int,
                     action="store",
                     default=60 * 30,
                     help="timeout in seconds for network converge")
    parser.addoption("--receive-timeout",
                     type=int,
                     action="store",
                     default=30,
                     help="timeout in seconds for receiving a single block")
    parser.addoption("--command-timeout",
                     type=int,
                     action="store",
                     default=60 * 3,
                     help="timeout in seconds for executing a rnode call")
    parser.addoption(
        "--random-seed",
        type=int,
        action="store",
        default=None,
        help="seed for the random numbers generator used in integration tests")
Beispiel #8
0
def pytest_addoption(parser: Parser) -> None:
    parser.addoption(
        "--testdata-folder",
        type=pathlib.Path,
        default=pathlib.Path("webviz-subsurface-testdata"),
        help="Path to webviz-subsurface-testdata folder",
    )
Beispiel #9
0
 def test_parse_will_set_default(self, parser: parseopt.Parser) -> None:
     parser.addoption("--hello", dest="hello", default="x", action="store")
     option = parser.parse([])
     assert option.hello == "x"
     del option.hello
     parser.parse_setoption([], option)
     assert option.hello == "x"
Beispiel #10
0
def pytest_addoption(parser: Parser) -> None:
    parser.addoption(
        "--dandi-api",
        action="store_true",
        default=False,
        help="Only run tests of the new Django Dandi API",
    )
Beispiel #11
0
 def test_parse_known_and_unknown_args(self,
                                       parser: parseopt.Parser) -> None:
     parser.addoption("--hello", action="store_true")
     ns, unknown = parser.parse_known_and_unknown_args(
         ["x", "--y", "--hello", "this"])
     assert ns.hello
     assert ns.file_or_dir == ["x"]
     assert unknown == ["--y", "this"]
Beispiel #12
0
 def test_drop_short_3(self, parser: parseopt.Parser) -> None:
     parser.addoption("--func-arg",
                      "--funcarg",
                      "--doit",
                      action="store_true")
     args = parser.parse(["abcd"])
     assert args.func_arg is False
     assert args.file_or_dir == ["abcd"]
Beispiel #13
0
 def test_drop_short_help0(self, parser: parseopt.Parser) -> None:
     parser.addoption("--func-args",
                      "--doit",
                      help="foo",
                      action="store_true")
     parser.parse([])
     help = parser.optparser.format_help()
     assert "--func-args, --doit  foo" in help
Beispiel #14
0
def pytest_addoption(parser: Parser) -> None:
    parser.addoption(
        "--integration",
        action="store_true",
        dest="integration",
        default=False,
        help="enable integration tests",
    )
def pytest_addoption(parser: Parser):
    parser.addoption(
        "--nml-dir",
        action="append",
        default=[Path("./tests/fixtures")],
        type=Path,
        help="list of directories to search for NML files",
    )
Beispiel #16
0
def pytest_addoption(parser: Parser) -> None:
    parser.addoption(
        "--runslow",
        action="store",
        default="no",
        choices=("yes", "no", "only"),
        help="whether to run slow tests",
    )
Beispiel #17
0
def pytest_addoption(parser: Parser) -> None:
    """Add custom parameters."""

    parser.addoption("--skip-marker",
                     "-S",
                     action="store",
                     default=None,
                     help="skip test(s) with certain marker.")
Beispiel #18
0
def pytest_addoption(parser: Parser) -> None:
    parser.addoption(
        "--host",
        "-H",
        action="store",
        default="localhost",
        help=
        "A host should be provided as a hostname (google.com) or ip address (172.217.13.238)"
    )
def pytest_addoption(parser: Parser):
    parser.addoption('--time-load-page',
                     default=20,
                     type=int,
                     help='Max time to load page')
    parser.addoption('--time-input-text',
                     default=20,
                     type=int,
                     help='Max time to input some text')
Beispiel #20
0
def pytest_addoption(parser: Parser) -> None:
    """Adds additional (API) command line arguments."""
    parser.addoption(
        "--chrome-path",
        action="store",
        help="chromedriver executable path e.g '/path/to/chromedriver'",
        type=str,
        default="/usr/local/bin/chromedriver",
    )
Beispiel #21
0
def pytest_addoption(parser: Parser):
    parser.addoption(
        "--edb-no-mock",
        help="Force the `edb` fixture to connect to a running MongoDB instance "
        "instead of falling back to mongomock",
        action="store_true",
        default=False,
        dest="edb_no_mock",
    )
Beispiel #22
0
    def test_parse_setoption(self, parser: parseopt.Parser) -> None:
        parser.addoption("--hello", dest="hello", action="store")
        parser.addoption("--world", dest="world", default=42)

        option = argparse.Namespace()
        args = parser.parse_setoption(["--hello", "world"], option)
        assert option.hello == "world"
        assert option.world == 42
        assert not args
Beispiel #23
0
def pytest_addoption(parser: Parser):
    parser.addoption(
        "--iaas",
        action="store",
        help="Infrastructure the tests should run on",
    )
    parser.addoption("--configfile",
                     action="store",
                     default="test_config.yaml",
                     help="Test configuration file")
Beispiel #24
0
def pytest_addoption(parser: PytestParser):
    parser.addoption(
        "--kwd",
        "--keep-workflow-wd",
        action="store_true",
        help="Keep temporary directories where workflows are run for "
        "debugging purposes. This also triggers saving of stdout and "
        "stderr in the workflow directory.",
        dest="keep_workflow_wd")
    parser.addoption(
        "--kwdof",
        "--keep-workflow-wd-on-fail",
        action="store_true",
        help="Similar to --keep-workflow-wd, but only keeps the temporary "
        "directories if there are test failures. On success all "
        "directories are deleted.",
        dest="keep_workflow_wd_on_fail")
    parser.addoption("--wt",
                     "--workflow-threads",
                     dest="workflow_threads",
                     default=1,
                     type=int,
                     help="The number of workflows to run simultaneously.")
    parser.addoption(
        "--symlink",
        action="store_true",
        help="Instead of copying the current working directory, create a "
        "similar directory structure where all files are replaced with "
        "symbolic links. This saves disk space, but should only be used "
        "for tests that do use these files read-only.")

    # Why `--tag <tag>` and not simply use `pytest -m <tag>`?
    # `-m` uses a "mark expression". So you have to type a piece of python
    # code instead of just supplying the tags you want. This is fine for the
    # user interface. But this is not fine for the plugin implementation. If
    # `-m` is used we need to evaluate the mark expression and make sure it
    # applies to the marks of the workflow. This requires reusing of the pytest
    # code, which is a hell to implement.
    # Additionally, markers can not have whitespace. So using the name of a
    # workflow as a default tag is not possible. Unless you first replace
    # whitespace for both command line and the test_.yml to make sure the marks
    # are correct. This is non-trivial. Alternatively, the schema could not
    # allow whitespace in names. That is just being plain annoying to the user
    # for no good reason. Maybe the user does not want to use tags, and then it
    # is extra hassle for a feature that is not even used.
    # So using pytest `-m` to select workflows is an implementation nightmare.
    # `--tag` is an easier solution.
    parser.addoption(
        "--tag",
        dest="workflow_tags",
        action="append",
        type=str,
        # Otherwise default is None and this does not work with list operations
        default=[],
        help="Run workflows with this name or tag.")
Beispiel #25
0
def pytest_addoption(parser: Parser):
    parser.addoption(
        "--prediction",
        action="store_true",
        help="To run tests with the marker : @pytest.mark.prediction",
    )
    parser.addoption(
        "--rewrite-expected",
        action="store_true",
        help="To force `record_stdout` and `recorder` to rewrite all files.",
    )
Beispiel #26
0
def pytest_addoption(parser: Parser) -> None:
    """
    This particular suite requires that the router1 ip address is informed,
    as it is used internally in the related inventory files.

    :param parser:
    :return:
    """

    parser.addoption("--msg-length", action="append", required=False, default=[1024],
                     help="Message length")
Beispiel #27
0
def pytest_addoption(parser: Parser) -> None:
    """
    Add options to the pytest command line for skipping tests with particular
    backends.
    """
    for backend in VuforiaBackend:
        parser.addoption(
            f'--skip-{backend.name.lower()}',
            action='store_true',
            default=False,
            help=f'Skip tests for {backend.value}',
        )
Beispiel #28
0
def pytest_addoption(parser: Parser) -> None:
    parser.addoption(
        "--roundtrip-neptune",
        action="store_true",
        default=False,
        help="Run roundtrip tests. These tests are slow and require \
        a configured neptune instance.")
    parser.addoption(
        "--roundtrip-janusgraph",
        action="store_true",
        default=False,
        help="Run roundtrip tests. These tests are slow and require \
        a configured janusgraph instance.")
Beispiel #29
0
def pytest_addoption(parser: Parser) -> None:
    parser.addoption(
        "--full-ci",
        action="store_true",
        default=False,
        help="run tests that are marked as only for CI",
    )
    parser.addoption(
        "--include-slow-tests",
        action="store_true",
        default=False,
        help="run tests that are a bit slow",
    )
Beispiel #30
0
 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