Skip to content

Conversation

@cclauss
Copy link
Contributor

@cclauss cclauss commented Dec 16, 2025

% uvx --python=3.12 unittest2pytest --write . # https://github.com/pytest-dev/unittest2pytest

Like #535 but with a different tool.

@cclauss cclauss force-pushed the unittest2pytest branch 5 times, most recently from 2e9b5ed to 4b7199f Compare December 18, 2025 11:48
acdha
acdha previously approved these changes Dec 18, 2025
Copy link
Collaborator

@acdha acdha left a comment

Choose a reason for hiding this comment

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

I think this is a good move — in the past we tried to stick with stdlib only to avoid people struggling around dependency management but the tools have improved a lot and that argument carries a lot less weight now (pysolr turns 20 in 3 years!).

Copy link
Contributor

@DhavalGojiya DhavalGojiya left a comment

Choose a reason for hiding this comment

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

Awesome.

@cclauss cclauss added dependencies Pull requests that update a dependency file tests python Pull requests that update Python code labels Dec 19, 2025
KazooException = None

# Add this line to prevent pytest from collecting the imported class
SolrTestCase.__test__ = False
Copy link
Collaborator

Choose a reason for hiding this comment

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

My concern with this is that it seems like it could set us up for a future change to cause it to ignore SolrTestCase in its original location since we're mutating that as well. I think we could avoid that risk by making the SolrTestCaseMixin do more of the work in SolrTestCase's constructor so we could import only the mixin, but it feels like there should be a better way to avoid this.

Copy link
Contributor

@DhavalGojiya DhavalGojiya Jan 10, 2026

Choose a reason for hiding this comment

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

My concern with this is that it seems like it could set us up for a future change to cause it to ignore SolrTestCase in its original location since we're mutating that as well. I think we could avoid that risk by making the SolrTestCaseMixin do more of the work in SolrTestCase's constructor so we could import only the mixin, but it feels like there should be a better way to avoid this.

Interesting, and you are absolutely right.
If we set SolrTestCase.__tests__ = False in the test_cloud.py module level file.
Because the module is cached in sys.modules, the same SolrTestCase class object (including the mutated attribute) will be reused and after this test_cloud.py file execution if any other module try to import SolrTestCase class they need to remove the above __tests__= False side effects from the SolrTestCase class, after inherit this class into any new class.
Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python Pull requests that update Python code tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants