Hi Holger, thanks for your quick response. > > Is it valid to use --boxed with --capture=no? It fails with > > UnicodeEncodeError. More details at > > https://bitbucket.org/hpk42/pytest/issue/573 > > In any case, could you please update the issue using the latest > pytest-2.6.3 and pytest-xdist-1.11?
Done. The issue remains the same. > Do you need to timestamp the captured output as one big thing or per line? I add a timestamp to each line, similar to the "ts" utility from moreutils[1] but in-process in python. I do this by "dup2"ing stdout & stderr to a a named pipe. There's a thread reading from the pipe, timestamping each line and writing it to a logfile. [1] http://manpages.ubuntu.com/manpages/trusty/man1/ts.1.html > Could you give a somewhat real-life example of what you would like to > customize in a pytest run? This may be more detail than you care about, but here goes: Stb-tester tests set-top boxes by capturing video from the set-top box (using video-capture hardware) and sending infrared signals to the set-top box (using a usb infrared emitter). The user's tests are written in python. With pytest I have a function-scope fixture that passes in an object that the user's test can use to access the video-processing and infrared-control functions. For each test run I also make a video recording of the set-top box's output. The timestamps in the log allow the user to correlate the logs to particular points in the video. The user can also capture other logs during a test run (for example logs from processes running on the set-top box itself) so the timestamps are also necessary to correlate these logs with stb-tester's logs of what the test script is doing. I'd like to be able to capture (and timestamp) any stdout & stderr output written by the user's script. If this turns out to be too hard I could provide the user's script a function like "stb_tester.log(...)" which does the timestamping and writes to a file, but that would be an incompatible break for my users -- their scripts currently use "print" for logging, and unless they change their scripts that logging would be lost when they upgrade stb-tester to the new version that uses pytest. I need to use "--boxed" to run each test in a different process, because very occasionally I get segfaults from the video-capture and image-processing libraries that I use, and I don't want that to bring down the rest of the tests. Cheers, Dave. _______________________________________________ Pytest-dev mailing list [email protected] https://mail.python.org/mailman/listinfo/pytest-dev
