-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable logcapture plugin by default #22
Conversation
Previously it was impossible to enable the plugin. This change was copied from the original nose source code.
Nope. See #12 for details. |
This is for log capture, not stdout. I see no reference to the |
It's set as needed. See: pynose/nose/plugins/logcapture.py Line 102 in 12eda10
|
And those logs were very noisy. Definitely don't want that enabled by default. |
Yes, it is noisy. However, when I'm running tests with pynose I'm seeing log output where previously I was not with nose 1.3.7. That's because the logcapture plugin is disabled by default in pynose, where it was not in nose. Also, the documentation says it's enabled by default: pynose/nose/plugins/logcapture.py Lines 5 to 6 in 12eda10
However, that was changed in the Add "pynose" files commit way back at the beginning of pynose: pynose/nose/plugins/logcapture.py Line 113 in 5b7314a
which differs from the same line in nose 1.3.7 default=not env.get(self.env_opt), dest="logcapture",
The logcapture plugin disables itself based on the value of pynose/nose/plugins/logcapture.py Lines 158 to 159 in 12eda10
|
Show me an example test where you see more logs in pynose than regular nose. |
Here is output from a test in https://github.com/dimagi/commcare-hq, where we're attempting to replace nose with pynose. Test command ./manage.py test -x corehq.motech.repeaters.tests.test_repeater:DataSourceRepeaterTest nose output
pynose output (after running
Applying this PR to pynose makes the output of both identical. |
pynose/nose/plugins/logcapture.py Lines 112 to 113 in 5b7314a
The |
Try with https://github.com/seleniumbase/SeleniumBase/tree/master/examples |
You'll have to show me either a basic example script I can run for the warnings, or an example of it in SeleniumBase so that I can verify the before & after part. |
OK, I verified. |
|
I tested with the following when running from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_base(self):
print("hi!") Using Using |
$ cat > test.py << EOF
import logging
def test_print():
print("print")
def test_logging():
log = logging.getLogger()
log.error("log")
EOF
$ sed -i 's/default=.,/default=0,/g' nose/plugins/logcapture.py
$ pynose test.py
print
.log
.
----------------------------------------------------------------------
Ran 2 tests in 0.001s
OK
$ sed -i 's/default=.,/default=1,/g' nose/plugins/logcapture.py
$ pynose test.py
print
..
----------------------------------------------------------------------
Ran 2 tests in 0.000s
OK Similarly with SeleniumBase
$ python -m venv sb
$ . sb/bin/activate
(sb) $ pip install -e . # install pynose in cwd
(sb) $ pip install seleniumbase
(sb) $ cat > sbtest.py << EOF
from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_base(self):
print("hi!")
EOF
(sb) $ sed -i 's/default=.,/default=1,/g' nose/plugins/logcapture.py
(sb) $ pynose sbtest.py --headless
hi!
.
----------------------------------------------------------------------
Ran 1 test in 0.300s
OK
(sb) $ sed -i 's/default=.,/default=0,/g' nose/plugins/logcapture.py
(sb) $ pynose sbtest.py --headless
hi!
.
----------------------------------------------------------------------
Ran 1 test in 0.312s
OK |
Good morning. Today I had some time to review all the details for this and provide better feedback. Have you seen pynose/nose/plugins/capture.py? It provides an option to undo the defaults that were set in If you use: pynose --capture-output ... then you will no longer see the output of the You can also set that in your environment: |
Yes. That captures output to stdout. I am not concerned with that at this time.
I am trying to fix capturing of Depending on how Did you see and try the simple examples I provided? |
OK, here's what I'll do: I'll create a Changes will arrive in the next release (soon). I've already created a local branch for it. |
I do not understand. Why are you opposed to the tiny change in this PR? There is already a plugin that does what you are proposing, and this is simply fixing a bug in it. |
I'll be adding command-line options to the existing plugin. Not adding a new plugin. You're proposing a change that breaks the default behavior of showing logging level warnings and errors. Some people want to see those by default. The better solution is to add an option that changes default behavior, rather than having the default behavior change. You're treating the default settings as a bug because you don't like the default settings. However, the current default settings are intended behavior. You need to take the considerations of other developers into account, and not just make changes for your own personal needs. |
The change I have proposed restores the default behavior of nose as it has been for many years. I think you are the one changing the defaults to match your own personal preferences. But go ahead and make the changes to add those new options. I can live with setting an extra environment variable to restore the behavior that nose has always had. |
The default logging level for the original
See https://github.com/mdmintz/pynose/releases/tag/v1.5.1 for the changes made to update logging output. |
Previously it was impossible to enable the plugin. This change was copied from the original nose source code.