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

changed formatting for unused kwargs error message #42

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jacobgolomb
Copy link

fixes issue #41

@ColmTalbot
Copy link
Collaborator

Thanks! We should probably also add a test for this, I'm not sure how straightforward it is to add tests for logged warnings.

@ColmTalbot
Copy link
Collaborator

It looks like there is support in pytest to capture log messages, e.g., here.

@mj-will mj-will added bug Something isn't working <10 lines labels Oct 4, 2024
@ColmTalbot ColmTalbot added this to the 2.4.0 milestone Oct 23, 2024
@ColmTalbot
Copy link
Collaborator

Ping @jacobgolomb

@jacobgolomb
Copy link
Author

It looks like there is support in pytest to capture log messages, e.g., here.

Instead I just captured the logger output with the unittest context manager and added an assertion that the expected warning message is in the logger's output. Is that an okay alternative?

Copy link
Collaborator

@ColmTalbot ColmTalbot left a comment

Choose a reason for hiding this comment

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

The new test looks good to me, happy to merge once the CI passes.

@jacobgolomb
Copy link
Author

The new test looks good to me, happy to merge once the CI passes.

The unit test is failing in the CI, but passes locally for me:

>>> from source_test import TestLalBBH
>>> test = TestLalBBH()
>>> test.setUp()
>>> test.test_unused_waveform_kwargs_message()

@jacobgolomb
Copy link
Author

The new test looks good to me, happy to merge once the CI passes.

The unit test is failing in the CI, but passes locally for me:

>>> from source_test import TestLalBBH
>>> test = TestLalBBH()
>>> test.setUp()
>>> test.test_unused_waveform_kwargs_message()

Maybe this could be due to self.parameters being updated before this specific test is run in CI and causing a different error to be raised first.

@ColmTalbot
Copy link
Collaborator

That's weird, have you tried running that full test class with pytest?

@ColmTalbot
Copy link
Collaborator

Actually, I feel like I remember reading that unittest log catching doesn't play well with pytest. That may be why I recommended pytest above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working <10 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants