Main change is splitting logic of `PythonTest.run()` method into `PythonTest.run_ctx()` context manager and `PythonTest.run()` method itself and add the `host` fixture which uses `PythonTest.run_ctx()` context manager to setup and teardown ScyllaDB node if `--test-py-init` argument is used. Otherwise, this fixture returns a value of `--host` CLI argument. Use dynamic scope provided by `testpy_test_fixture_scope()` function instead of `session` to maintain compatibility with `test.py` and `./run` scripts. Other related changes: * Add utility `get_testpy_test()` function to `pylib.suite.base` which combines all required steps to create an instance of `Test` class and rework `testpy_test` fixture to use it. * Switch to use dynamic fixture scope controlled by `--test-py-init` CLI argument to improve compatibility with test.py. And because in test.py mode the scope is `session`, also change default event loop scope to `session`. * Convert `get_valid_alternator_role()` to fixture to have more control on the scope of the cache used. Additionally, function `new_dynamodb_session()` was also converted to a fixture, because it uses `get_valid_alternator_role()`. * Replace dups of `cql` and `this_dc` fixtures in `rest_api` and `pylib/cql_repl` with imports from `cqlpy`. * Change `build_mode` fixture to return "unknown" if no --mode arguments provided (this is mainly for alternator and cqlpy tests) * Create a parent directory for a test log file just before opening this file in `run_test()` function instead of having this as a side effect in `Test.__init__()`. And changes that remove pytest CLI argument duplicates to be able to run tests from different test suites in one pytest session: * Add 3 supplementary functions to `test.pylib.suite.python`: `add_host_option()` (which adds `--host` options to pytest session), `add_cql_connection_options()` (which adds `--port`, and `--ssl`), and `--add-s3-options` (which adds options related to S3 connection.) Each function decorated with `@cache` decorator to be executed once per pytest session and avoid CLI options duplication for runs which executes `alternator`, `cqlpy`, `rest_api`, or `broadcast_tables` in one pytest session. * Move `--auth_username` and `--auth_password` options from `cluster/conftest.py` to add_scylla_cql_connection_options() and slightly rework `cql` fixture to support these options. * Remove `--input`, `--output`, and `--keep-tmp` pytest CLI opionts from `cluster/object_store/conftest.py` because they are not used in these suite. * Remove `--omit-scylla-output` CLI option from pytest argparser. Instead, remove it from `sys.argv` in `cqlpy/run.py`. Also, no need to check this option in `alternator/run`. Closes scylladb/scylladb#23849 * github.com:scylladb/scylladb: test.py: python: run tests using bare pytest command test.py: rework testpy_test fixture test.py: alternator: convert get_valid_alternator_role() to fixture test.py: python: split logic of PythonTest.run() test.py: add credentials options to add_cql_connection_options() test.py: python: remove dups of cql and this_dc fixtures test.py: remove duplication of pytest CLI options test.py: remove unused CLI options test.py: remove `--omit-scylla-output` from pytest argparser test.py: set build_mode to "unknown" if no --mode argument test.py: create directory for test log in run_test()
43 lines
1.9 KiB
INI
43 lines
1.9 KiB
INI
[pytest]
|
|
asyncio_mode = auto
|
|
asyncio_default_fixture_loop_scope = session
|
|
|
|
log_format = %(asctime)s.%(msecs)03d %(levelname)s> %(message)s
|
|
log_date_format = %H:%M:%S
|
|
|
|
markers =
|
|
slow: tests that take more than 30 seconds to run
|
|
replication_factor: replication factor for RandomTables
|
|
without_scylla: run without attaching to a scylla process
|
|
enable_tablets: create keyspace with tablets enabled or disabled
|
|
repair: tests for repair
|
|
cpp: marker for c++ tests
|
|
prepare_3_nodes_cluster: prepare 3 nodes cluster for test case based on suite.yaml (all tests from old topology folder)
|
|
prepare_3_racks_cluster: prepare 3 nodes cluster in 1 dc and 3 racks for test case based on suite.yaml
|
|
single_node: test that are mark like this, should be using only one node, and should boot much quicker (dtest only)
|
|
|
|
norecursedirs = manual perf lib
|
|
# Ignore warnings about HTTPS requests without certificate verification
|
|
# (see issue #15287). Pytest breaks urllib3.disable_warnings() in conftest.py,
|
|
# so we need to do this here.
|
|
#
|
|
# Ignore warning of
|
|
# PytestWarning: record_property is incompatible with junit_family 'xunit2' (use 'legacy' or 'xunit1')
|
|
# Because `record_property` adds <properties> inside <testcase>, which is not allowed
|
|
# as per the latest xunit2 schema. see
|
|
# https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsdtestcase,
|
|
# an alternative is `record_testsuite_property`, but we want to attach test
|
|
# log on a per-test basis. so let's continue using this feature before
|
|
# switching to xunit1 or legacy.
|
|
filterwarnings =
|
|
ignore::urllib3.exceptions.InsecureRequestWarning
|
|
ignore:record_property is incompatible with junit_family:pytest.PytestWarning
|
|
ignore::DeprecationWarning:importlib._bootstrap
|
|
ignore::DeprecationWarning:botocore
|
|
ignore::DeprecationWarning:pytest_elk_reporter
|
|
|
|
tmp_path_retention_count = 1
|
|
tmp_path_retention_policy = failed
|
|
|
|
python_files = test_*.py *_test.py *_tests.py
|