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

[PY-53431] Fix setattr(self.current_test_item, _ASSERTION_FAILURE_KEY, (op, left, right)) error #284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ben-cutler-datarobot
Copy link

@ben-cutler-datarobot ben-cutler-datarobot commented Feb 18, 2025

Hello, in my PyCharm IDE I frequently get an error:

self = <teamcity.pytest_plugin.EchoTeamCityMessages object at 0x130e3d810>
config = <_pytest.config.Config object at 0x10a15c520>, op = '==', left = 2
right = 0

    def pytest_assertrepr_compare(self, config, op, left, right):
>       setattr(self.current_test_item, _ASSERTION_FAILURE_KEY, (op, left, right))
E       AttributeError: 'NoneType' object has no attribute '_teamcity_assertion_failure'

Because the default value of current_test_item is None:

self.current_test_item = None

As do many other people at my company who use pycharm.
https://youtrack.jetbrains.com/issue/PY-53431
We have manually edit the code in the PyCharm environment to comment out the setattr call, then whenever we get a pycharm update we have to do it again. It's a massive hassle, and I'd like to fix this.

Unfortunately, I have no way to test this 😢

@ben-cutler-datarobot
Copy link
Author

Hey, @throwable-one , I saw you worked on this:
7dc200e

Do you mind taking a look?

@ben-cutler-datarobot ben-cutler-datarobot changed the title Fix setattr(self.current_test_item, _ASSERTION_FAILURE_KEY, (op, left, right)) error [PY-53431] Fix setattr(self.current_test_item, _ASSERTION_FAILURE_KEY, (op, left, right)) error Feb 18, 2025
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.

1 participant