Skip to content

fix: avoid instantiating a connection on _repr__ #3653

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

robertosantamaria-scopely
Copy link
Contributor

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

Please provide a description of the change here.

@@ -1424,10 +1424,16 @@ def __init__(
self._lock = threading.Lock()
self.reset()

def __repr__(self) -> (str, str):
def __repr__(self) -> str:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest something like the following:
connection_kwargs_repr = ",".join( [f"{k}={v}" for k, v in self.connection_kwargs.items()] ) return ( f"<{self.__class__.__module__}.{self.__class__.__name__}" f"({self.connection_class.__module__}.{self.connection_class.__name__}" f"({connection_kwargs_repr})))>" )

With this representation, it will be obvious what the Connection class is and from which module(it can be custom).
We will also be able to see all the provided kwargs when a new connection is instantiated.

Although this covers most of the cases, with the above code, the default args set to the connection are still missing and it would require fixing some unit tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated this but the checks that fail do not show any specific error, right? Do I need to do something else for them to run @petyaslavova ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@robertosantamaria-scopely when you open a specific failed job, all test outputs will be initially collapsed.
You need to find the text "RESP2 standalone tests" and expand it - then the errors can be investigated.

If you prefer, I can take a look at the failures and fix them, you already helped us so much... :)

@petyaslavova petyaslavova added the maintenance Maintenance (CI, Releases, etc) label May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance (CI, Releases, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants