adamchainz / time-machine

Travel through time in your tests.
MIT License
710 stars 34 forks source link

Run CI on Windows as well #458

Open adamchainz opened 4 months ago

adamchainz commented 4 months ago

Adding CI to reproduce the error fixed in #457.

adamchainz commented 4 months ago

Ugh, still 19 failures:

FAILED tests/test_time_machine.py::UnitTestClassTests::test_class_decorator
FAILED tests/test_time_machine.py::test_destination_datetime_tzinfo_zoneinfo_windows
FAILED tests/test_time_machine.py::test_destination_string_naive[1970-01-01 00:00-UTC-0]
FAILED tests/test_time_machine.py::test_destination_datetime_tzinfo_zoneinfo_no_orig_tz
FAILED tests/test_time_machine.py::test_destination_datetime_tzinfo_zoneinfo
FAILED tests/test_time_machine.py::test_destination_string_naive[1970-01-01-UTC-0]
FAILED tests/test_time_machine.py::test_time_time - AttributeError: module 't...
FAILED tests/test_time_machine.py::test_destination_string_naive[1970-01-01 00:00-US/Eastern-18000]
FAILED tests/test_time_machine.py::test_time_time_ns - AttributeError: module...
FAILED tests/test_time_machine.py::test_destination_datetime_tzinfo_zoneinfo_nested
FAILED tests/test_time_machine.py::test_destination_string_naive[1970-01-01 00:00-Europe/Amsterdam--3600]
FAILED tests/test_time_machine.py::test_destination_string_naive[1970-01-01-Europe/Amsterdam--3600]
FAILED tests/test_time_machine.py::test_time_time_windows - AttributeError: m...
FAILED tests/test_time_machine.py::test_destination_string_naive[1970-01-01-US/Eastern-18000]
FAILED tests/test_time_machine.py::test_fixture_used_tick_true - AttributeErr...
FAILED tests/test_time_machine.py::test_move_to_datetime_with_tzinfo_zoneinfo
FAILED tests/test_time_machine.py::test_move_to_datetime - AttributeError: mo...
FAILED tests/test_time_machine.py::test_move_to_datetime_change_tick_on - Att...
FAILED tests/test_time_machine.py::UnitTestClassCustomSetUpClassTests::test_class_decorator
adamchainz commented 4 months ago

Okay, with a temporary patch to run on 3.13 and Windows only, I see an extra 20th error:

_ ERROR at setup of UnitTestClassSetUpClassSkipTests.test_thats_always_skipped _
AttributeError: module 'time' has no attribute 'clock_gettime_ns'
The above exception was the direct cause of the following exception:
cls = <class 'tests.test_time_machine.UnitTestClassSetUpClassSkipTests'>
    @functools.wraps(orig_setUpClass)
    def setUpClass(cls: type[TestCase]) -> None:
>       self.__enter__()
.tox\py313\Lib\site-packages\time_machine\__init__.py:301: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox\py313\Lib\site-packages\time_machine\__init__.py:263: in __enter__
    return self.start()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <time_machine.travel object at 0x00000205117390A0>
    def start(self) -> Coordinates:
        global coordinates_stack

>       _time_machine.patch_if_needed()
E       SystemError: <built-in function patch_if_needed> returned a result with an exception set
.tox\py313\Lib\site-packages\time_machine\__init__.py:233: SystemError

That's the one being fixed by #457. Going to cherry-pick the commit and check it is fixed.

adamchainz commented 4 months ago

Success, only 19 failures again.