Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[3.10] bpo-45500: Rewrite test_dbm (GH-29002)#29069

Merged
ambv merged 1 commit into
python:3.10python/cpython:3.10from
ambv:backport-975b94b-3.10ambv/cpython:backport-975b94b-3.10Copy head branch name to clipboard
Oct 19, 2021
Merged

[3.10] bpo-45500: Rewrite test_dbm (GH-29002)#29069
ambv merged 1 commit into
python:3.10python/cpython:3.10from
ambv:backport-975b94b-3.10ambv/cpython:backport-975b94b-3.10Copy head branch name to clipboard

Conversation

@ambv

@ambv ambv commented Oct 19, 2021

Copy link
Copy Markdown
Contributor
  • 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

NOTE: this is a little different from GH-29002 because 3.10 doesn't have support for bytes filenames and os.PathLike paths (only added in GH-21849).

https://bugs.python.org/issue45500

* 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>
@ambv

ambv commented Oct 19, 2021

Copy link
Copy Markdown
Contributor Author

The only difference in executed test cases is additional test cases for whichdb:

(diff of -before and +after)

-test_keys (test.test_dbm.WhichDBTestCase) ... ok
+test_keys (test.test_dbm.TestCase_dumb) ... ok
+test_keys (test.test_dbm.TestCase_gnu) ... ok
+test_keys (test.test_dbm.TestCase_ndbm) ... ok

@ambv

ambv commented Oct 19, 2021

Copy link
Copy Markdown
Contributor Author

From test results on the PR:

0:03:22 load avg: 3.90 [104/427] test_dbm_dumb passed -- running: test_asyncio (1 min 22 sec), test_concurrent_futures (1 min 16 sec)
0:05:21 load avg: 4.26 [175/427] test_dbm passed -- running: test_multiprocessing_spawn (1 min 10 sec), test_concurrent_futures (3 min 16 sec)
0:06:00 load avg: 4.08 [209/427] test_dbm_ndbm passed -- running: test_multiprocessing_spawn (1 min 49 sec)
0:07:24 load avg: 4.67 [310/427] test_dbm_gnu passed

@ambv ambv merged commit 325b2c2 into python:3.10 Oct 19, 2021
@ambv ambv deleted the backport-975b94b-3.10 branch October 19, 2021 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.