mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-21 09:00:35 +00:00
Add path constants to `test` module and use them in different test suites instead of own dups of the same code: - TOP_SRC_DIR : ScyllaDB's source code root directory - TEST_DIR : the directory with test.py tests and libs - BUILD_DIR : directory with ScyllaDB's build artefacts Add TestSuite.log_dir attribute as a ScyllaDB's build mode subdir of a path provided using `--tmpdir` CLI argument. Don't use `tmpdir` name because it mixed up with pytest's built-in fixture and `--tmpdir` option itself. Change default value for `--tmdir` from `./testlog` to `TOP_SRC_DIR/testlog` Refactor `ResourceGather*` classes to use path from a `test` object instead of providing it separately. Move modes constants to `test` module and remove duplications. Move `prepare_dirs()` and `start_3rd_party_services()` from `pylib.util` to `pylib.suite.base` to avoid circular imports (with little refactoring to use `pathlib.Path` instead of `str` as paths.) Also, in some places refactor to use f-strings for formatting.
23 lines
1011 B
Python
23 lines
1011 B
Python
#
|
|
# Copyright (C) 2024-present ScyllaDB
|
|
#
|
|
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
#
|
|
from pathlib import PosixPath
|
|
|
|
from pytest import Collector
|
|
|
|
from test.pylib.cpp.boost.boost_facade import BoostTestFacade, COMBINED_TESTS
|
|
from test.pylib.cpp.common_cpp_conftest import collect_items, get_combined_tests
|
|
|
|
|
|
def pytest_collect_file(file_path: PosixPath, parent: Collector):
|
|
"""
|
|
Method triggered automatically by pytest to collect files from a directory. Boost and unit have the same logic for
|
|
collection, the only difference in execution, and it's covered by facade
|
|
"""
|
|
# One of the files in the directory has additional extensions .inc. It's not a test and will not have a binary for
|
|
# execution, so it should be excluded from collecting
|
|
if file_path.suffix == '.cc' and '.inc' not in file_path.suffixes and file_path.stem != COMBINED_TESTS.stem:
|
|
return collect_items(file_path, parent, facade=BoostTestFacade(parent.config, get_combined_tests()))
|