This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients nuse, steven.daprano
Date 2021-11-17.04:46:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637124371.44.0.772122569534.issue45827@roundup.psfhosted.org>
In-reply-to
Content
At a quick glance, I am 95% sure the problem lies in these two snippets of your code, not unittest:

    class My_Time:
        months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]


    if is_leapyr(year):
        my_time.months[1] = 29


The first snippet makes months, a mutable list, a class attribute, which means it is shared by all instances of the class. The second snippet mutates that list, which means every single instance will see the same value.

So commenting out some tests will change whether or not the shared list gets mutated, which will change whether or not other tests pass or fail.

I think the smallest change you need make to fix your code is to put the initialisation of My_Time into an `__init__` method, so that the attributes (including the list) are no longer shared between all instances.

    class My_Time:
        def __init__(self):
            ...
History
Date User Action Args
2021-11-17 04:46:11steven.dapranosetrecipients: + steven.daprano, nuse
2021-11-17 04:46:11steven.dapranosetmessageid: <1637124371.44.0.772122569534.issue45827@roundup.psfhosted.org>
2021-11-17 04:46:11steven.dapranolinkissue45827 messages
2021-11-17 04:46:11steven.dapranocreate