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

Tests: fix database test to actually pass mode through #178

Closed
wants to merge 2 commits into from

Conversation

akx
Copy link

@akx akx commented Aug 27, 2024

It looks like ever since the mode argument was surfaced in 06b1b62 a decade ago, it was actually never tested; self.mode was not used in BaseTestReader.

In addition, 3f8c7ca adds support for MODE_FD, but the test suite it added is empty, so it's simply removed here.

This also switches from unittest self.assert*s to plain pytest asserts and pytest.raises()es.

@akx akx marked this pull request as draft August 27, 2024 09:03
@akx akx marked this pull request as ready for review August 27, 2024 09:05
oschwald added a commit that referenced this pull request Aug 27, 2024
@oschwald
Copy link
Member

Good catch on the mode test! It looks like the original change was not completely implemented. That said, doing all the different tests with the different modes seems unnecessary. In the maxminddb library, the modes significantly change the behavior, but in this library there is no behavior change besides passing the modes through to maxminddb, which this doesn't even end up confirming. It would be better to have a single test for that. I added this in #179.

In general, I would encourage you to submit a single PR for each change you are proposing. This PR contains several unrelated changes, e.g., moving to pytest asserts, making it hard to review each change individually. Also, for larger changes, it usually makes more sense to discuss them first before making a PR.

oschwald added a commit that referenced this pull request Aug 27, 2024
@akx
Copy link
Author

akx commented Aug 28, 2024

e.g., moving to pytest asserts, making it hard to review each change individually.

Had to be done (and in fact it had been done as part of #180, but I wanted to separate this from that refactoring). parametrize doesn't work with unittest based tests, and self.assert* do not exist on non-unittest suites.

@akx akx mentioned this pull request Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants