Skip to content

Fix logging usage in hooks pytest_sessionstart/finish #4204

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

Merged
merged 1 commit into from
Oct 20, 2018

Conversation

vbarbaresi
Copy link
Member

Fix issue #3340: missing logging on some hooks

Add logging capture for pytest_sessionstart() and pytest_sessionfinish()

I didn't find anywhere this could be documented; these hooks aren't well documented and this just restores a normal behavior.

@codecov
Copy link

codecov bot commented Oct 20, 2018

Codecov Report

Merging #4204 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4204      +/-   ##
==========================================
- Coverage   95.81%   95.81%   -0.01%     
==========================================
  Files         109      109              
  Lines       24257    24285      +28     
  Branches     2390     2394       +4     
==========================================
+ Hits        23242    23268      +26     
- Misses        720      721       +1     
- Partials      295      296       +1
Flag Coverage Δ
#docs 28.51% <41.17%> (+0.01%) ⬆️
#doctesting 28.51% <41.17%> (+0.01%) ⬆️
#linting 28.51% <41.17%> (+0.01%) ⬆️
#linux 95.59% <100%> (-0.01%) ⬇️
#nobyte 91.89% <100%> (ø) ⬆️
#numpy 92.92% <100%> (+0.02%) ⬆️
#pexpect 41.27% <41.17%> (-0.01%) ⬇️
#py27 93.95% <100%> (ø) ⬆️
#py34 92.23% <100%> (+0.04%) ⬆️
#py35 92.24% <100%> (+0.04%) ⬆️
#py36 93.9% <100%> (-0.01%) ⬇️
#py37 92.27% <100%> (+0.04%) ⬆️
#trial 92.92% <100%> (+0.02%) ⬆️
#windows 94.05% <100%> (ø) ⬆️
#xdist 93.78% <100%> (+0.15%) ⬆️
Impacted Files Coverage Δ
src/_pytest/logging.py 96.02% <100%> (+0.25%) ⬆️
testing/logging/test_reporting.py 100% <100%> (ø) ⬆️
src/_pytest/capture.py 93.36% <0%> (-0.46%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b0eed7b...db106d6. Read the comment docs.

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @vbarbaresi, thanks!

@nicoddemus nicoddemus merged commit b9990f7 into pytest-dev:master Oct 20, 2018
@vbarbaresi vbarbaresi deleted the 3340_log_hooks branch October 20, 2018 20:22
twmr added a commit to twmr/pytest that referenced this pull request Feb 4, 2019
During the review of pytest-dev#4204 it was not noticed that _setup_cli_logging
was already called in the collection phase (pytest_collection). Now
_setup_cli_Logging is called in two hooks: pytest_collection and
pytest_sessionstart. It only makes sense to call _setup_cli_logging once
(in the first called hook of the logging plugin).
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 this pull request may close these issues.

2 participants