-
Notifications
You must be signed in to change notification settings - Fork 323
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
Pytest: unittest
=> pytest
Conversion
#1742
Conversation
Previous tests in `signal_type` were converted to pytest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a ton @b8zhong for the help! Your conversions look clean, and I appreciate the extra time you took to simplify or improve the tests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, went too fast, there are some CI failures on some of the files you touched.
For the typing errors, use your best judgement on whether it's worth the time to fix typing in tests or whether to liberally sprinkle #type: ignore
. I have soundtimes found typing catches unittest bugs, but more often than not it seems like too much effort.
@Dcallies Thanks for reviewing! Verified the test files now, passes with I thought typechecking would trigger whenever py files are touched though lol |
Thanks for rerunning; put faiss as typeignore but I guess it doesn't like that whoops |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be tricky to reproduce the exact results as CI - one trick I've done is check the version being installed by the CI, and I think we hardcode the version of mypy to help avoid random failures,
Settings say (from CI output at https://github.com/facebook/ThreatExchange/actions/runs/13074520123/job/36487583072?pr=1742):
platform linux -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0
mypy-1.7.1
Nothing jumps out to me from the CI failures - you might have some luck breaking the PR into one file at a time, but I'll leave that up to you.
python-threatexchange/threatexchange/signal_type/tests/test_pdq_index2.py
Outdated
Show resolved
Hide resolved
@Dcallies Could you rerun now? Tried w/ Passes (at least locally), so I think we should be good; caught a few things on my side. The test I marked as skip is because compare_hash isn't supported.. or I could just remove it. But let me know what you think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like everything is passing now!
Thanks for merging David! |
Summary
Previous tests were in unittest, and should now be inline with pytest (resolves #1686)
Previous tests in
signal_type
were converted to pytestFormatted with
black hasher-matcher-actioner python-threatexchange
.Test Plan
Added tests.