mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
integration tests: persist pdb history between test runs
Run pytest --pdb. On failure or breakpoint, it will fall back to PDB. Commands written here will be saved to a local file and loaded at the start of the next test run.
This commit is contained in:
parent
5cd2d26781
commit
e98d6fd24c
3
.gitignore
vendored
3
.gitignore
vendored
@ -164,6 +164,9 @@ tests/queries/0_stateless/*.generated-expect
|
||||
tests/queries/0_stateless/*.expect.history
|
||||
tests/integration/**/_gen
|
||||
|
||||
# pytest --pdb history
|
||||
.pdb_history
|
||||
|
||||
# rust
|
||||
/rust/**/target*
|
||||
# It is autogenerated from *.in
|
||||
|
@ -13,6 +13,34 @@ from helpers.network import _NetworkManager
|
||||
logging.raiseExceptions = False
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def pdb_history(request):
|
||||
"""
|
||||
Fixture loads and saves pdb history to file, so it can be preserved between runs
|
||||
"""
|
||||
if request.config.getoption("--pdb"):
|
||||
import readline # pylint:disable=import-outside-toplevel
|
||||
import pdb # pylint:disable=import-outside-toplevel
|
||||
|
||||
def save_history():
|
||||
readline.write_history_file(".pdb_history")
|
||||
|
||||
def load_history():
|
||||
try:
|
||||
readline.read_history_file(".pdb_history")
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
load_history()
|
||||
pdb.Pdb.use_rawinput = True
|
||||
|
||||
yield
|
||||
|
||||
save_history()
|
||||
else:
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, scope="session")
|
||||
def tune_local_port_range():
|
||||
# Lots of services uses non privileged ports:
|
||||
|
Loading…
Reference in New Issue
Block a user