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

Handle logging issues at teardown #3703

Merged
merged 2 commits into from
Aug 1, 2022
Merged

Handle logging issues at teardown #3703

merged 2 commits into from
Aug 1, 2022

Conversation

alanmcruickshank
Copy link
Member

Resolves #3702.

I'm testing the effects of this on the draft name deprecation PR.

@alanmcruickshank
Copy link
Member Author

Confirm effective on #3701 . Logging much more sensible.

Issue was due to adding logging handlers in the CLI module which aren't otherwise properly cleaned up.

@alanmcruickshank alanmcruickshank marked this pull request as ready for review August 1, 2022 17:02
@@ -29,6 +30,31 @@
re_ansi_escape = re.compile(r"\x1b[^m]*m")


@pytest.fixture()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@pytest.fixture()
@pytest.fixture(autouse=True)

I think if you make this change, it'll automatically apply this fixture to every test in this .py file without you having to explicitly add it to each test. (This can be handy because it means future tests added to this file will automatically get the same behavior.)

https://docs.pytest.org/en/6.2.x/fixture.html#autouse-fixtures-fixtures-you-don-t-have-to-request

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried that and it didn't work 🤔 . I'll have another go - but if not then I'll just merge as is.

Copy link
Member

Choose a reason for hiding this comment

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

No worries. We can always do it later. I've successfully used autouse fixtures a few times, so there may be something subtle going wrong. They are definitely a bit magical, which is both good and bad. 😬

Copy link
Member

@barrywhart barrywhart left a comment

Choose a reason for hiding this comment

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

Looks good! One possible suggestion for how to simplify/futureproof this a bit.

@codecov
Copy link

codecov bot commented Aug 1, 2022

Codecov Report

Merging #3703 (e481259) into main (213dd62) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##              main     #3703   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          176       176           
  Lines        13413     13413           
=========================================
  Hits         13413     13413           

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 213dd62...e481259. Read the comment docs.

@alanmcruickshank alanmcruickshank merged commit e5457dd into main Aug 1, 2022
@alanmcruickshank alanmcruickshank deleted the ac/logging branch August 1, 2022 21:01
@alanmcruickshank alanmcruickshank changed the title Attempt to handle logging issues at teardown Handle logging issues at teardown Aug 1, 2022
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.

CI Bug: Logging is very very verbose due to pytest issue
2 participants