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

bpo-30822: Fix testing of datetime module. #2530

Merged
merged 6 commits into from Jul 2, 2017

Conversation

Projects
None yet
5 participants
@musically-ut
Contributor

musically-ut commented Jul 1, 2017

On master and in versions 3.6 and 3.5, there is a bug in how certain tests are executed differently for the C extension and python extension. The execution of the tests (in datetimetester.py) depends on the following condition (or the negation thereof):

if '_Fast' in str(self):
    # ...

The cls.__name__ is modified in the test_datetime.py to be:

    cls.__name__ = name + suffix   # suffix in ['_Fast', '_Pure']

However, str(self) to derives the class name from cls.__qualname__ and not cls.__name__. This meant that _Fast was never in str(self) and, hence, some of the tests were being unnecessarily skipped (notably test_name_cleanup, which was failing).

This PR fixes the problem by clearly setting a string value on the class (_test_type) and then conditioning tests based on that value. Also, instead of editing the __name__ of the class, the __qualname__ is edited so that the tests show the correct variant of the test being run in verbose mode, which helps reduce confusion [1].

Also, on master and in version 3.6, there was another bug which prevented all tests from running because of an accidental resetting of the global variable test_classes inside a loop. That is fixed in a separate commit.

#1493 depends on this PR.

  • Backport to 3.6
  • Backport to 3.5

[1]: Example on core-mentorship archives (accessible only to members).

@mention-bot

This comment has been minimized.

Show comment
Hide comment
@mention-bot

mention-bot Jul 1, 2017

@musically-ut, thanks for your PR! By analyzing the history of the files in this pull request, we identified @abalkin, @serhiy-storchaka and @birkenfeld to be potential reviewers.

mention-bot commented Jul 1, 2017

@musically-ut, thanks for your PR! By analyzing the history of the files in this pull request, we identified @abalkin, @serhiy-storchaka and @birkenfeld to be potential reviewers.

@serhiy-storchaka serhiy-storchaka requested a review from abalkin Jul 2, 2017

Show outdated Hide outdated Lib/test/datetimetester.py

@serhiy-storchaka serhiy-storchaka merged commit 98b6bc3 into python:master Jul 2, 2017

3 checks passed

bedevere/issue-number Issue number 30822 found.
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

musically-ut added a commit to musically-ut/cpython that referenced this pull request Jul 3, 2017

[3.5] bpo-30822: Fix testing of datetime module. (GH-2530)
Only C implementation was tested..
(cherry picked from commit 98b6bc3)
@bedevere-bot

This comment has been minimized.

Show comment
Hide comment
@bedevere-bot

bedevere-bot Jul 3, 2017

GH-2550 is a backport of this pull request to the 3.5 branch.

bedevere-bot commented Jul 3, 2017

GH-2550 is a backport of this pull request to the 3.5 branch.

musically-ut added a commit to musically-ut/cpython that referenced this pull request Jul 3, 2017

[3.6] bpo-30822: Fix testing of datetime module. (GH-2530)
Only C implementation was tested.
(cherry picked from commit 98b6bc3)
@bedevere-bot

This comment has been minimized.

Show comment
Hide comment
@bedevere-bot

bedevere-bot Jul 3, 2017

GH-2551 is a backport of this pull request to the 3.6 branch.

bedevere-bot commented Jul 3, 2017

GH-2551 is a backport of this pull request to the 3.6 branch.

vstinner added a commit that referenced this pull request Jul 5, 2017

vstinner added a commit that referenced this pull request Jul 5, 2017

Revert "bpo-30822: Fix testing of datetime module." (#2588)
* Revert "bpo-30854: Fix compile error when --without-threads (#2581)"

This reverts commit 0c31163.

* Revert "NEWS for 30777 (#2576)"

This reverts commit aaa917f.

* Revert "bpo-21624: IDLE -- minor htest fixes (#2575)"

This reverts commit 2000150.

* Revert "bpo-30777: IDLE: configdialog - add docstrings and improve comments (#2440)"

This reverts commit 7eb5883.

* Revert "bpo-30319: socket.close() now ignores ECONNRESET (#2565)"

This reverts commit 67e1478.

* Revert "bpo-30789: Use a single memory block for co_extra. (#2555)"

This reverts commit 378ebb6.

* Revert "bpo-30845: Enhance test_concurrent_futures cleanup (#2564)"

This reverts commit 3df9dec.

* Revert "bpo-29293: multiprocessing.Condition.notify() lacks parameter `n` (#2480)"

This reverts commit 4835041.

* Revert "Remove outdated FOX from GUI FAQ (GH-2538)"

This reverts commit d3ed287.

* Revert "bpo-6691: Pyclbr now reports nested classes and functions. (#2503)"

This reverts commit 246ff3b.

* Revert "bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)"

This reverts commit 6969eaf.

* Revert "bpo-30832: Remove own implementation for thread-local storage (#2537)"

This reverts commit aa0aa04.

* Revert "bpo-30764: Fix regrtest --fail-env-changed --forever (#2536)"

This reverts commit 5e87592.

* Revert "bpo-30822: Deduplicate ZoneInfoTest classes in test_datetime. (#2534)"

This reverts commit 34b5487.

* Revert "bpo-30822: Fix testing of datetime module. (#2530)"

This reverts commit 98b6bc3.

musically-ut added a commit to musically-ut/cpython that referenced this pull request Jul 20, 2017

bpo-30822: Fix testing of datetime module. (#2530)
Only C implementation was tested.

vstinner added a commit that referenced this pull request Jul 21, 2017

bpo-30822: Fix testing of datetime module. (#2530) (#2783)
Only C implementation was tested.

musically-ut added a commit to musically-ut/cpython that referenced this pull request Jul 22, 2017

[3.5] bpo-30822: Fix testing of datetime module. (GH-2530) (GH-2783)
Only C implementation was tested..
(cherry picked from commit 287c559)

musically-ut added a commit to musically-ut/cpython that referenced this pull request Jul 22, 2017

[3.6] bpo-30822: Fix testing of datetime module. (GH-2530) (GH-2783)
Only C implementation was tested.
(cherry picked from commit 287c559)

musically-ut added a commit to musically-ut/cpython that referenced this pull request Jul 22, 2017

[3.6] bpo-30822: Fix testing of datetime module. (GH-2530) (GH-2783)
Only C implementation was tested..
(cherry picked from commit 287c559)

vstinner added a commit that referenced this pull request Jul 26, 2017

[3.6] bpo-30822: Fix testing of datetime module. (GH-2530) (GH-2783) (#…
…2816)

* [3.6] bpo-30822: Fix testing of datetime module. (GH-2530) (GH-2783)

Only C implementation was tested.
(cherry picked from commit 287c559)

* [3.6] bpo-30822: Fix testing of datetime module. (GH-2530) (GH-2783)

Only C implementation was tested..
(cherry picked from commit 287c559)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment