mdmintz / pynose

pynose fixes nose to extend unittest and make testing easier
https://pypi.org/project/pynose/
GNU Lesser General Public License v2.1
11 stars 6 forks source link

Compatibility option? #10

Closed dirkf closed 1 year ago

dirkf commented 1 year ago

I have a CI test suite that is run with nose for older Python versions, going back to 2.6, and your revamp (many thanks) for 3.9 and later. The output is not so easy to check for the latter case, presumably because of the different default for -s.

With -s as the default, the documented options would have to be changed to unset that option, leaving presumably NOSE_NOCAPTURE=0 as the only solution.

In case you should want to make further changes to the option defaults, could there be a single environment variable that forces all option defaults to match those in the original nose?

mdmintz commented 1 year ago

From the pynose 1.4.8 release notes: https://github.com/mdmintz/pynose/releases/tag/v1.4.8

To enable capture, set a Python env variable called "NOSE_CAPTURE" to "1".

It can be done like this in an __init__.py file:

import os
os.environ["NOSE_CAPTURE"] = "1"

This restores the default setting of nose, which is capturing output. (Note that if output is captured, print() calls won't be seen.)

Capturing output can also be enabled with: --capture-output.