Ric W
Ric W

Reputation: 2392

How to print django-nose exception below log

Django-nose prints the exception and stack trace somewhere hidden in the middle of two logs in the following format:

  1. Live Log (as it is being executed)
  2. The exception and stack trace
  3. The recorded log

This is really unhelpful if the logs are very long (hundreds of lines) as one has to find the "in between" stack trace to know what actually went wrong, rather than just scrolling to the bottom and being able to see the error.

Is there any way of formatting this differently so that the stack trace and exception are printed last (aka 1. Live log, 2. recorded log, 3. exception and stack trace)?! From what I can tell there are no options to do so.

Upvotes: 0

Views: 413

Answers (1)

Oleksiy
Oleksiy

Reputation: 6567

Nose keeps track of standard output (stdout) and logging (python logging module) in separate containers. You can control the capturing process of the output during the test run for both buffers. So if you want to disable capturing of the recorded log with --nocapture and --nologcapture your tests will end with stack trace. This way step (3) will be eliminated. To reorder sequence as you describe it, you may want to make a custom plugin.

Upvotes: 3

Related Questions