[3.9] bpo-45500: Rewrite test_dbm (GH-29002)#29074
Merged
corona10 merged 1 commit intopython:3.9from Oct 20, 2021
Merged
Conversation
* Generate test classes at import time. It allows to filter them when run with unittest. E.g: "./python -m unittest test.test_dbm.TestCase_gnu -v". * Create a database class in a new directory which will be removed after test. It guarantees that all created files and directories be removed and will not conflict with other dbm tests. * Restore dbm._defaultmod after tests. Previously it was set to the last dbm module (dbm.dumb) which affected other tests. * Enable the whichdb test for dbm.dumb. * Move test_keys to the correct test class. It does not test whichdb(). * Remove some outdated code and comments.. (cherry picked from commit 975b94b) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Member
|
I reopen this PR due to bot staling. |
corona10
approved these changes
Oct 20, 2021
corona10
reviewed
Oct 20, 2021
| setup_test_dir() | ||
| dbm._defaultmod = module | ||
| # Try with empty files first | ||
| with module.open(_fname, 'c'): pass |
Contributor
Author
There was a problem hiding this comment.
Yeah, the difference is noted in the PR description.
corona10
reviewed
Oct 20, 2021
| ndbm = None | ||
|
|
||
| _fname = test.support.TESTFN | ||
| dirname = test.support.TESTFN |
Contributor
Author
|
Thanks for taking care of this, @corona10! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
run with unittest. E.g: "./python -m unittest test.test_dbm.TestCase_gnu -v".
test. It guarantees that all created files and directories be removed
and will not conflict with other dbm tests.
dbm module (dbm.dumb) which affected other tests.
(cherry picked from commit 975b94b)
Co-authored-by: Serhiy Storchaka storchaka@gmail.com
NOTE: this is a little different from GH-29002 because 3.9 doesn't have support for
bytesfilenames and os.PathLike paths (only added in GH-21849). It also doesn't havetest.support.os_helperandtest.support.import_helperso the imports are different for that.https://bugs.python.org/issue45500