schrodinger.test.log_parser module¶
Parse pytest log files to help track down parallel test failures. All log files must have been generated using subprocess tests (i.e. “-n <NUMBER>” or “-n auto”) and the “-v” flag. Running this script from the command line will output statistics about the failures as well as a recipe to reproduce a worker process failure.
Usage: log_parser.py <log file 1> [<log file 2>…]
Note: To automatically run the Python unit tests 10 times in a row and generate logs that are approrpiate for input into this script, you can run
mkdir ../test_logs
for i in {1..10}; do
make unittest TEST_ARGS="-n=auto -v" 2>&1 | tee ../test_logs/${i}.txt;
done
from $SCHRODINGER/mmshare-v*/python/test. This will put the test logs into a new $SCHRODINGER/mmshare-v*/python/test_logs directory.
- schrodinger.test.log_parser.parse_log(logfile)[source]¶
Parse the specified pytest log file. The log file must have been generated using subprocess tests (i.e. “-n <NUMBER>” or “-n auto”) and the “-v” flag. This method reports which tests were run on each worker process, the number of failed tests per worker process, and the index of the first failed test.
- Parameters
logfile (str) – The path of the log file to parse
- Return type
tuple(list(list(str)), list(int or None), int)
Return value is a tuple of:
A list of list of tests run on each worker process, formatted as [list of tests run on worker process 0, list of tests run on worker process 1, …]
A list of the first failed test index on each worker process, or None if no tests failed on that worker.
The number of worker processes with failed tests.
- schrodinger.test.log_parser.parse_logs(logfiles)[source]¶
Parse multiple pytest log files. All log files must have been generated using subprocess tests (i.e. “-n <NUMBER>” or “-n auto”) and the “-v” flag.
- Parameters
logfiles (list(str)) – A list of log file paths
- Return type
tuple(int, int, int, int, int, list(str) or None)
The return value is a tuple of
The total number of pytest runs processed
The number of failed runs
The total number of worker processes over all runs
The total number of worker processes with a test failure over all runs
The maximum number of worker processes with a test failure in a single test run
All tests run on a single worker process up to and including the first failed test. If multiple worker processes contained a failed test, then the shortest recipe is provided. If no worker processes contained a failed test, will be None.