Skip to content
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

Integrate with --capture and -v options of pytest #14

Closed
abusalimov opened this issue Nov 9, 2015 · 10 comments · May be fixed by #25
Closed

Integrate with --capture and -v options of pytest #14

abusalimov opened this issue Nov 9, 2015 · 10 comments · May be fixed by #25

Comments

@abusalimov
Copy link
Collaborator

There's a pytest-logging plugin by @s0undt3ch that provides a nice way to control logging through the default -v and -s (alias for --capture=no) options of pytest-core. The verbosity flag naturally configures the logging level, and the capturing option - whether to output live logs for all tests, or only capture them to show in case of a failure afterwards.

For instance, one can run py.test -vv -s to see live logs at the INFO level or above emitted by all tests.

It would be nice to have something like that in pytest-catchlog.

@eisensheng
Copy link
Owner

This appears to be somewhat related to #1 but the solution provided by pytest-logging for changing log verbosity is by far more appealing because of the simplicity of the options IMHO. It would be nice if @s0undt3ch could provide a PR to integrate this feature in pytest-catchlog.

The options --logging-format and --logging-date-format provided by pytest-logging are already covered by pytest-catchlog.

@s0undt3ch
Copy link
Contributor

I will provide a PR, just haven't gotten the time.

@s0undt3ch
Copy link
Contributor

My PR will obsolete my plugin and once you decide to rename catchlog to logging I will also remove my plugin from pypi...

@eisensheng
Copy link
Owner

Perfectly fine. 😉 My day work also keeps me busy during the week so I just try to catch up with discussions on work days and try to devote some time to other projects like this one here during the weekend.

Regarding the renaming we have a discussion running on the pytest mailing list. Maybe it does makes sense after all to rename this Plugin to pytest-logging. My opinion changed in favour to the rename.

@s0undt3ch
Copy link
Contributor

Once my PR is merged and catchlog releases a new version, can someone ping me so that I update the read me to redirect people to catchlog?

abusalimov added a commit to abusalimov/pytest-catchlog that referenced this issue Nov 20, 2015
References:
  * eisensheng#14 ("Integrate with --capture and -v options of pytest")
  * eisensheng#20 ("Move pytest-logging functionality to pytest-catchlog.")
@Nikratio
Copy link

When this functionality is integrated, please provide an option for catchlog to preserve the current behavior (i.e., do not print any log messages to stderr/stdout while the test is running, only report them afterwards and only if the test has failed).

@The-Compiler
Copy link
Collaborator

@Nikratio you mean you want that behaviour even with --capture=no, which displays all other output immediately?

@Nikratio
Copy link

Yes.

But more importantly, when using --capture=fd and encountering a failed test, I don't want the log messages to appear twice (as captured output and as captured log messages), and I would like to keep the distinction between captured output and captured log messages (so using only output capture without capturing log messages is not a solution).

@twmr
Copy link

twmr commented Feb 23, 2018

This issue can already be closed. The live-logging functionality has already been integrated into pytest-core.

@The-Compiler
Copy link
Collaborator

Indeed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants