mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 09:36:20 +09:00
nixos/test-driver: use ipython via ptpython
Closes #180089 I realized that the previous commits relying on `sys.exit` for dealing with `MachineError`/`RequestedAssertionFailed` exit the interactive session which is kinda bad. This patch uses the ipython driver: it seems to have equivalent features such as auto-completion and doesn't stop on SystemExit being raised. This also fixes other places where this happened such as things calling `log.error` on the CompositeLogger.
This commit is contained in:
parent
d587d569e0
commit
e2b3517f59
2 changed files with 5 additions and 5 deletions
|
@ -31,6 +31,7 @@ python3Packages.buildPythonApplication {
|
|||
colorama
|
||||
junit-xml
|
||||
ptpython
|
||||
ipython
|
||||
]
|
||||
++ extraPythonPackages python3Packages;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import os
|
|||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import ptpython.repl
|
||||
import ptpython.ipython
|
||||
|
||||
from test_driver.driver import Driver
|
||||
from test_driver.logger import (
|
||||
|
@ -136,11 +136,10 @@ def main() -> None:
|
|||
if args.interactive:
|
||||
history_dir = os.getcwd()
|
||||
history_path = os.path.join(history_dir, ".nixos-test-history")
|
||||
ptpython.repl.embed(
|
||||
driver.test_symbols(),
|
||||
{},
|
||||
ptpython.ipython.embed(
|
||||
user_ns=driver.test_symbols(),
|
||||
history_filename=history_path,
|
||||
)
|
||||
) # type:ignore
|
||||
else:
|
||||
tic = time.time()
|
||||
driver.run_tests()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue