Skip to content

Python implementation of datetime module is not being tested correctly. #75005

Closed

Description

@musically-ut
BPO 30822
Nosy @abalkin, @vstinner, @ned-deily, @serhiy-storchaka, @musically-ut
PRs
  • bpo-30822: Fix testing of datetime module. #2530
  • bpo-30822: Deduplicate ZoneInfoTest classes in test_datetime. #2534
  • [3.5] bpo-30822: Fix testing of datetime module. (GH-2530) #2550
  • [3.6] bpo-30822: Fix testing of datetime module. (GH-2530) #2551
  • Revert "bpo-30822: Fix testing of datetime module." #2588
  • bpo-30822: Exclude tzdata from regrtest --all #2775
  • [3.6] bpo-30822: Exclude tzdata from regrtest --all (#2775) #2777
  • [3.5] bpo-30822: Exclude tzdata from regrtest --all (#2775) #2781
  • [3.5] bpo-30822: regrtest: remove tzdata #2782
  • bpo-30822: Fix testing of datetime module. #2783
  • [2.7] bpo-30822: regrtest: fix -u extralargefile #2788
  • [3.5] bpo-30822: Fix testing of datetime module. (GH-2530) (GH-2783) #2815
  • [3.6] bpo-30822: Fix testing of datetime module. (GH-2530) (GH-2783) #2816
  • [3.6] bpo-30822: Deduplicate ZoneInfoTest classes in test_datetime. (GH-2534) #3405
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2017-07-26.11:52:55.129>
    created_at = <Date 2017-06-30.23:47:48.837>
    labels = ['3.7', 'type-bug', 'tests']
    title = 'Python implementation of datetime module is not being tested correctly.'
    updated_at = <Date 2017-09-08.22:44:35.784>
    user = 'https://github.com/musically-ut'

    bugs.python.org fields:

    activity = <Date 2017-09-08.22:44:35.784>
    actor = 'vstinner'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2017-07-26.11:52:55.129>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2017-06-30.23:47:48.837>
    creator = 'musically_ut'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30822
    keywords = []
    message_count = 48.0
    messages = ['297455', '297470', '297515', '297517', '297518', '297519', '297520', '297522', '297523', '297524', '297525', '297530', '297546', '297548', '297554', '297555', '297557', '297559', '297562', '297571', '297573', '297612', '297734', '297736', '297743', '297752', '297753', '297760', '297762', '297763', '298032', '298033', '298059', '298664', '298717', '298721', '298725', '298726', '298729', '298732', '298755', '298756', '298786', '299221', '299222', '299223', '299224', '301749']
    nosy_count = 5.0
    nosy_names = ['belopolsky', 'vstinner', 'ned.deily', 'serhiy.storchaka', 'musically_ut']
    pr_nums = ['2530', '2534', '2550', '2551', '2588', '2775', '2777', '2781', '2782', '2783', '2788', '2815', '2816', '3405']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30822'
    versions = ['Python 3.6', 'Python 3.7']

    Activity

    1. musically-ut commented on Jun 30, 2017

      musically-utmannequin
      MannequinAuthor

      While investigating http://bugs.python.org/issue30302 it was discovered that the Python implementation of the datetime module was not being tested correctly.

      The datetimetester.py was supposed to execute tests twice, once for the _Fast implementation (i.e. C extension code in _datetimemodule.c) and once for the _Pure implementation (i.e the Python code).

      The fix is contained in the following two commits:

      The bug does not effect Python 2.7 as the C version of the datetime module had not been introduced back then. However, as fas as I can tell, the fix needs to be applied to all Python 3.x branches.

    2. serhiy-storchaka commented on Jul 1, 2017

      @serhiy-storchaka
      Member

      Please provide a separate PR for this. After merging it with the master branch it should be backported to 3.6 and 3.5 (3.4 and 3.3 are for security only fixes). Add your name in Misc/ACKS. Changes in Misc/NEWS.d/ are not required.

    3. added
      type-bugAn unexpected behavior, bug, or error
      and removed
      type-featureA feature request or enhancement
      on Jul 1, 2017
    4. serhiy-storchaka commented on Jul 2, 2017

      @serhiy-storchaka
      Member

      New changeset 98b6bc3 by Serhiy Storchaka (Utkarsh Upadhyay) in branch 'master':
      bpo-30822: Fix testing of datetime module. (bpo-2530)
      98b6bc3

    5. musically-ut commented on Jul 2, 2017

      musically-utmannequin
      MannequinAuthor

      Are there any guides re: backporting commits?

      Just to confirm verify that I'm going about it right; I’m planning on cherry-picking relevant commits back to branch 3.5, 3.6, resolving the merge conflicts, and then opening two separate PRs for them with bpo-30822 in their titles.

      Sounds about right?

      ~
      ut

    6. ned-deily commented on Jul 2, 2017

      @ned-deily
      Member

      Serhiy, it appears that the added tests are taking a long time to run and thus causing many buildbot failures, for example:

      http://buildbot.python.org/all/builders/ARMv7%20Ubuntu%203.x/builds/1013

    7. serhiy-storchaka commented on Jul 2, 2017

      @serhiy-storchaka
      Member

      Oh, test.datetimetester.ZoneInfoTest[Europe/Andorra]_Pure_Pure_Pure -- something looks wrong.

    8. musically-ut commented on Jul 2, 2017

      musically-utmannequin
      MannequinAuthor

      I can reproduce the names with _Pure_Pure_Pure if I run the tests with -utzdata. Investigating.

      ~
      ut

    9. serhiy-storchaka commented on Jul 2, 2017

      @serhiy-storchaka
      Member

      The quick solution -- just deduplicate test classes.

      But the code needs rewriting. Current code is tricky and fragile. It doesn't work with --list-cases (and I suppose it doesn't work well with other advanced unittest features). This would be not easy.

    10. serhiy-storchaka commented on Jul 2, 2017

      @serhiy-storchaka
      Member

      Are there any guides re: backporting commits?

      Just to confirm verify that I'm going about it right; I’m planning on cherry-picking relevant commits back to branch 3.5, 3.6, resolving the merge conflicts, and then opening two separate PRs for them with bpo-30822 in their titles.

      All right. See https://docs.python.org/devguide/committing.html#backporting-changes-to-an-older-version . You can cherry-pick manually or using cherry_picker.py which adds correct prefix to commit message and helps to create a pull request.

    11. 26 remaining items

    12. vstinner commented on Jul 20, 2017

      @vstinner
      Member

      New changeset 5b392bb by Victor Stinner in branch 'master':
      bpo-30822: Exclude tzdata from regrtest --all (bpo-2775)
      5b392bb

    13. vstinner commented on Jul 20, 2017

      @vstinner
      Member

      New changeset 96ef06f by Victor Stinner in branch '3.6':
      bpo-30822: Exclude tzdata from regrtest --all (bpo-2775) (bpo-2777)
      96ef06f

    14. vstinner commented on Jul 20, 2017

      @vstinner
      Member

      New changeset 645e503 by Victor Stinner in branch '3.5':
      bpo-30822: Exclude tzdata from regrtest --all (bpo-2775) (bpo-2781)
      645e503

    15. vstinner commented on Jul 20, 2017

      @vstinner
      Member

      (Oops, I gone too fast in my 3.5 backport. tzdata was only introduced in Python 3.6, for me it was something older. I wrote a new fix for 3.5, to only add extralargefile, but don't add tzdata.)

    16. vstinner commented on Jul 20, 2017

      @vstinner
      Member

      New changeset bf3a1e9 by Victor Stinner in branch '3.5':
      bpo-30822: regrtest: remove tzdata (bpo-2782)
      bf3a1e9

    17. vstinner commented on Jul 21, 2017

      @vstinner
      Member

      New changeset 80ebc43 by Victor Stinner in branch '2.7':
      bpo-30822: regrtest: fix -u extralargefile (bpo-2788)
      80ebc43

    18. vstinner commented on Jul 21, 2017

      @vstinner
      Member

      New changeset 287c559 by Victor Stinner (Utkarsh Upadhyay) in branch 'master':
      bpo-30822: Fix testing of datetime module. (bpo-2530) (bpo-2783)
      287c559

    19. vstinner commented on Jul 21, 2017

      @vstinner
      Member

      Utkarsh comment on the PR:

      I'm afraid I don't really know how to read the waterfall chart at http://buildbot.python.org/all/waterfall.

      Yeah, sorry about this awful view :-) We now have a mailing list getting notifications when a buildbot fails:
      https://mail.python.org/mm3/mailman3/lists/buildbot-status.python.org/

      We got two new failures since yesterday on Windows buildbots, but it's related to IDLE and so unrelated to your change. So a quick check says that test_datetime doesn't time out anymore!

      Previously, the test failed on a few buildbots. I checked the test output to look if test_datetime became the new slowest test and ... no. For example, on PPC64 Fedora 3.x, test_datetime is not even listed in the "10 slowest tests", which means that it took 36 sec or less, whereas the test took longer than 15 minutes when tzdata was used.

      IMHO you can already cook a first backport for 3.6, but I would prefer to wait another day just to make sure to everything is fine (to wait for new buildbot builds).

    20. vstinner commented on Jul 26, 2017

      @vstinner
      Member

      New changeset c52cea4 by Victor Stinner (Utkarsh Upadhyay) in branch '3.6':
      [3.6] bpo-30822: Fix testing of datetime module. (GH-2530) (GH-2783) (bpo-2816)
      c52cea4

    21. vstinner commented on Jul 26, 2017

      @vstinner
      Member

      Ok, I merged the change in the 3.6 branch.

      I decided to not merge the 3.5 change, since it's now too late: 3.5 slowly enters a new security-only fixes:
      #2815

      Thanks Utkarsh Upadhyay for your work on datetime, not only this issue, but also repr(timedelta) (and maybe also timedelta constructor doc later? ;-)).

    22. musically-ut commented on Jul 26, 2017

      musically-utmannequin
      MannequinAuthor

      Thanks Victor! \o/

      Secretly, I'm just happy that my legacy will not be a commit which broke all (?) the build-bots and had to be reverted. :P

      W.r.t. the docs; in retrospect, that'll probably have a larger impact on the end-users and is less likely to cause disagreement. I probably should have led with that. :)

      ~
      ut

    23. vstinner commented on Jul 26, 2017

      @vstinner
      Member

      Secretly, I'm just happy that my legacy will not be a commit which broke all (?) the build-bots and had to be reverted. :P

      Reverting is a new policy that we decided last June:
      https://mail.python.org/pipermail/python-committers/2017-June/004588.html

      Sorry that your commit was the first guilty, but honestly, it was a wise decision since it allowed to discuss how to handle tzdata without the pressure of broken buildbots. Nowadays, Python relies much more on CI for pull requests than before the migration to GitHub.

      Well, read the thread if you want to know the full rationale.

    24. vstinner commented on Sep 8, 2017

      @vstinner
      Member

      New changeset 3892799 by Victor Stinner (Miss Islington (bot)) in branch '3.6':
      [3.6] bpo-30822: Deduplicate ZoneInfoTest classes in test_datetime. (GH-2534) (bpo-3405)
      3892799

    25. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    3.7 (EOL)end of lifetestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions