Skip to content

Fix conflict with other Pytest plugins#297

Merged
justinmayer merged 2 commits intoTeemu:mainfrom
TolstochenkoDaniil:3rd-party/fix-reporter
Aug 23, 2025
Merged

Fix conflict with other Pytest plugins#297
justinmayer merged 2 commits intoTeemu:mainfrom
TolstochenkoDaniil:3rd-party/fix-reporter

Conversation

@TolstochenkoDaniil
Copy link
Copy Markdown
Contributor

@TolstochenkoDaniil TolstochenkoDaniil commented Aug 19, 2025

Description

Using pytest-sugar with another 3rd-party pytest plugins can cause conflicts
As for example when using pytest-sugar with pytest-durations as pytest --pytest-resultlog=duration.log . leads to such error after pytest execution

venv/lib/python3.11/site-packages/pytest_durations/plugin.py", line 119, in pytest_terminal_summary
    terminalreporter = type(terminalreporter)(config=config, file=result_log_fp)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: SugarTerminalReporter.__init__() got an unexpected keyword argument 'config'

The main reason is that SugarTerminalReporter.__init__ differs from it's base class and it breaks further usage

This PR fixes this kind of issue

Copy link
Copy Markdown
Collaborator

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

can you also add some unit tests for this?

Copy link
Copy Markdown
Collaborator

@justinmayer justinmayer left a comment

Choose a reason for hiding this comment

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

Thank you for the submission, Daniil. It seems like the tests are failing on the current branch, so could you please take a look and see what needs to be changed? Also, I made a minor suggested modification to the change-log entry in the release file.

RELEASE.md Outdated
@@ -0,0 +1,3 @@
Release type: patch

Signature of SugarTerminalReporter to avoid conflicts with other pytest plugins
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think a verb is missing here. Perhaps something like the following instead?

Adjust signature of SugarTerminalReporter to avoid conflicts with other pytest plugins

@justinmayer justinmayer changed the title 3rd party/fix reporter Fix conflict with other Pytest plugins Aug 23, 2025
Copy link
Copy Markdown
Collaborator

@justinmayer justinmayer left a comment

Choose a reason for hiding this comment

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

Thanks again for the fix, Daniil. Much appreciated! 🌟

@justinmayer justinmayer merged commit 6798042 into Teemu:main Aug 23, 2025
4 checks passed
@TolstochenkoDaniil
Copy link
Copy Markdown
Contributor Author

Thanks again for the fix, Daniil. Much appreciated! 🌟

I do really like pytest-sugar and glad to be helpful 🤝

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.

3 participants