Skip to content

Some unit tests are sensitive to Timezone of host machine #10816

Closed
@notatallshaw

Description

@notatallshaw

Description

Running the pip unit tests on Windows in (UTC-5:00) Eastern (US & Canada):

  1. nox -s test-3.7 -- -m unit --verbose --numprocesses auto --showlocals

I get a handful of FAILEDs, however if I change the hosts timezone to UTC I get 5 less FAILEDs, specifically this set of tests:

FAILED tests/unit/test_base_command.py::test_log_file_command_error - assert False
FAILED tests/unit/test_base_command.py::test_log_command_error - assert False
FAILED tests/unit/test_base_command.py::test_log_command_success - AssertionError: assert '2019-01-17T01:00:37,040 fake' == '2019-01-17T06:00:37,040 fake'
FAILED tests/unit/test_logging.py::TestIndentingFormatter::test_format_with_timestamp[INFO-2019-01-17T06:00:37,040 hello\n2019-01-17T06:00:37,040 world] - As...
FAILED tests/unit/test_logging.py::TestIndentingFormatter::test_format_with_timestamp[WARNING-2019-01-17T06:00:37,040 WARNING: hello\n2019-01-17T06:00:37,040 world]

Expected behavior

Shouldn't need to change timezone to run pip tests locally?

pip version

22

Python version

3.7.9

OS

Windows 10

How to Reproduce

Above

Output

No response

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: testsTesting and related thingstype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions