You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
4aabadb tests: have combine_logs default to most recent test dir (James O'Beirne)
Pull request description:
Have `combine_logs.py` default to the most recent test directory if no argument is provided. This allows you to avoid an annoying copy-paste when iterating on a failing test, since you can do something like
```sh
alias testlogs='./test/functional/combine_logs.py -c | less'
./test/functional/some_test.py # fails
testlogs
```
Tree-SHA512: 919642ab09c314888a23c9491963b35b9da87e60deb740d1d5e816444aa9bdda5e519dc8ca131669f2d563167ef5f5abb14e22f20f47bf8362915ed578181846
help=('temporary test directory to combine logs from. '
36
+
'Defaults to the most recent'))
24
37
parser.add_argument('-c', '--color', dest='color', action='store_true', help='outputs the combined log with events colored by source (requires posix terminal colors. Use less -r for viewing)')
25
38
parser.add_argument('--html', dest='html', action='store_true', help='outputs the combined log as html. Requires jinja2. pip install jinja2')
26
-
args, unknown_args=parser.parse_known_args()
39
+
args=parser.parse_args()
27
40
28
41
ifargs.htmlandargs.color:
29
42
print("Only one out of --color or --html should be specified")
30
43
sys.exit(1)
31
44
32
-
# There should only be one unknown argument - the path of the temporary test directory
33
-
iflen(unknown_args) !=1:
34
-
print("Unexpected arguments"+str(unknown_args))
45
+
testdir=args.testdirorfind_latest_test_dir()
46
+
47
+
ifnottestdir:
48
+
print("No test directories found")
35
49
sys.exit(1)
36
50
37
-
log_events=read_logs(unknown_args[0])
51
+
ifnotargs.testdir:
52
+
print("Opening latest test directory: {}".format(testdir), file=sys.stderr)
0 commit comments