Skip to content

Refactor _setup_cli_logging code#4734

Merged
twmr merged 1 commit into
pytest-dev:masterfrom
twmr:refactor_clilogging
Feb 7, 2019
Merged

Refactor _setup_cli_logging code#4734
twmr merged 1 commit into
pytest-dev:masterfrom
twmr:refactor_clilogging

Conversation

@twmr

@twmr twmr commented Feb 6, 2019

Copy link
Copy Markdown
Contributor

Change the indentation in _setup_cli_logging by moving the
self._log_cli_enabled check outside of the _setup_cli_logging method.

Thanks for submitting a PR, your contribution is really appreciated!

Here's a quick checklist that should be present in PRs (you can delete this text from the final description, this is
just a guideline):

  • Create a new changelog file in the changelog folder, with a name like <ISSUE NUMBER>.<TYPE>.rst. See changelog/README.rst for details.
  • Target the master branch for bug fixes, documentation updates and trivial changes.
  • Target the features branch for new features and removals/deprecations.
  • Include documentation when adding new features.
  • Include new tests or update existing tests when applicable.

Unless your change is trivial or a small documentation fix (e.g., a typo or reword of a small section) please:

  • Add yourself to AUTHORS in alphabetical order;

@twmr twmr force-pushed the refactor_clilogging branch from 90a3c07 to 8ea5f6e Compare February 6, 2019 20:43

@nicoddemus nicoddemus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, we also need a changelog entry. Seems to me like a "bugfix" about disabling logging automatically in case capture is also disabled, something which did not work previously anyway?

Comment thread src/_pytest/logging.py Outdated
Comment thread src/_pytest/logging.py
@codecov

codecov Bot commented Feb 7, 2019

Copy link
Copy Markdown

Codecov Report

Merging #4734 into master will decrease coverage by 0.07%.
The diff coverage is 80.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4734      +/-   ##
==========================================
- Coverage   95.65%   95.58%   -0.08%     
==========================================
  Files         113      113              
  Lines       24968    24971       +3     
  Branches     2479     2480       +1     
==========================================
- Hits        23884    23868      -16     
- Misses        763      780      +17     
- Partials      321      323       +2
Flag Coverage Δ
#docs 29.57% <4.76%> (-0.02%) ⬇️
#doctesting 29.57% <4.76%> (-0.02%) ⬇️
#linting 29.57% <4.76%> (-0.02%) ⬇️
#linux 95.42% <80.95%> (-0.06%) ⬇️
#nobyte 91.65% <80.95%> (-0.64%) ⬇️
#numpy 42.07% <4.76%> (-51.02%) ⬇️
#pexpect 42.07% <4.76%> (ø) ⬆️
#py27 93.64% <80.95%> (-0.03%) ⬇️
#py34 ?
#py35 ?
#py36 ?
#py37 93.52% <80.95%> (-0.27%) ⬇️
#trial 42.07% <4.76%> (-51.02%) ⬇️
#windows 93.13% <80.95%> (-0.74%) ⬇️
#xdist 93.7% <80.95%> (-0.02%) ⬇️
Impacted Files Coverage Δ
src/_pytest/logging.py 95.42% <80.95%> (-0.67%) ⬇️
src/_pytest/compat.py 93.96% <0%> (-3.02%) ⬇️
src/_pytest/doctest.py 94.2% <0%> (-2.18%) ⬇️
testing/test_pdb.py 98.54% <0%> (-0.49%) ⬇️
src/_pytest/assertion/rewrite.py 94.99% <0%> (-0.49%) ⬇️
src/_pytest/capture.py 93.66% <0%> (-0.46%) ⬇️
src/_pytest/pytester.py 87% <0%> (-0.43%) ⬇️
src/_pytest/terminal.py 91.73% <0%> (+0.82%) ⬆️

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 526f4a9...7b8fd0c. Read the comment docs.

@twmr twmr force-pushed the refactor_clilogging branch from 8ea5f6e to 8c89741 Compare February 7, 2019 18:16
@twmr

twmr commented Feb 7, 2019

Copy link
Copy Markdown
Contributor Author

Looks good, we also need a changelog entry. Seems to me like a "bugfix" about disabling logging automatically in case capture is also disabled, something which did not work previously anyway?

I just had a look again and checked what happens if the capturemanager plugin is disabled. The live logging still works (because the _LiveLoggingStreamHandler supports that self.capture_manager is None.)

So this PR actually does not fix a bug. Therefore, I decided not to write a bugfix changelog entry.

I've adapted the code s.t. the current behavior is not changed.

@nicoddemus

Copy link
Copy Markdown
Member

So this PR actually does not fix a bug. Therefore, I decided not to write a bugfix changelog entry.

I agree, thanks for the explanation. 👍

Change the indentation in _setup_cli_logging by moving the
self._log_cli_enabled check outside of the _setup_cli_logging method.
@twmr twmr force-pushed the refactor_clilogging branch from 8c89741 to 7b8fd0c Compare February 7, 2019 18:40
@twmr twmr merged commit a1fcd6e into pytest-dev:master Feb 7, 2019
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