Skip to content

Tests fail with pytzdata==2018.8 or 2018.9 #358

@altendky

Description

@altendky

When working #357 I noticed a test was failing based on updated libraries since the last Travis build on master. It seems that pytzdata==2018.8 broke test_timezones_are_loadable().

sdispater/pytzdata@af119bf

https://github.com/sdispater/pendulum/blob/d0eebd906e63f99ca9603f7d57b0f6d09ce75940/tests/tz/test_timezones.py#L12-L16

Specifically, it fails for 'Africa/Casablanca'. I'll try to take a look at this and see if I can understand the issue.

test results
 ~/pendulum   masterpoetry run python -m pytest tests
================================================= test session starts ==================================================
platform linux -- Python 3.7.2, pytest-3.10.1, py-1.8.0, pluggy-0.9.0
rootdir: /home/altendky/pendulum, inifile:
plugins: cov-2.6.1
collected 1097 items                                                                                                   

tests/test_helpers.py ...................                                                                        [  1%]
tests/test_main.py .                                                                                             [  1%]
tests/test_parsing.py ......                                                                                     [  2%]
tests/date/test_add.py ................                                                                          [  3%]
tests/date/test_behavior.py ...........                                                                          [  4%]
tests/date/test_comparison.py ........................                                                           [  7%]
tests/date/test_construct.py ..                                                                                  [  7%]
tests/date/test_day_of_week_modifiers.py .....................................................                   [ 12%]
tests/date/test_diff.py ....................................................................                     [ 18%]
tests/date/test_fluent_setters.py ...                                                                            [ 18%]
tests/date/test_getters.py ..............                                                                        [ 19%]
tests/date/test_start_end_of.py .........................................                                        [ 23%]
tests/date/test_strings.py ........                                                                              [ 24%]
tests/date/test_sub.py ...............                                                                           [ 25%]
tests/datetime/test_add.py ................................                                                      [ 28%]
tests/datetime/test_behavior.py .........................                                                        [ 30%]
tests/datetime/test_comparison.py ...................................                                            [ 34%]
tests/datetime/test_construct.py ................                                                                [ 35%]
tests/datetime/test_create_from_timestamp.py ...                                                                 [ 35%]
tests/datetime/test_day_of_week_modifiers.py .......................................................             [ 40%]
tests/datetime/test_diff.py .................................................................................... [ 48%]
..............................................                                                                   [ 52%]
tests/datetime/test_fluent_setters.py ................                                                           [ 54%]
tests/datetime/test_from_format.py ..........................................................                    [ 59%]
tests/datetime/test_getters.py .......................................                                           [ 62%]
tests/datetime/test_naive.py .........                                                                           [ 63%]
tests/datetime/test_start_end_of.py ............................................                                 [ 67%]
tests/datetime/test_strings.py ........................                                                          [ 69%]
tests/datetime/test_sub.py ............................                                                          [ 72%]
tests/datetime/test_timezone.py ...                                                                              [ 72%]
tests/duration/test_add_sub.py .......                                                                           [ 73%]
tests/duration/test_arithmetic.py ...                                                                            [ 73%]
tests/duration/test_behavior.py ..                                                                               [ 73%]
tests/duration/test_construct.py ............                                                                    [ 74%]
tests/duration/test_in_methods.py .....                                                                          [ 75%]
tests/duration/test_in_words.py ..........                                                                       [ 76%]
tests/duration/test_total_methods.py .....                                                                       [ 76%]
tests/formatting/test_formatter.py .....................                                                         [ 78%]
tests/helpers/test_local_time.py ..                                                                              [ 78%]
tests/localization/test_da.py .                                                                                  [ 78%]
tests/localization/test_de.py .                                                                                  [ 79%]
tests/localization/test_es.py .                                                                                  [ 79%]
tests/localization/test_fa.py .                                                                                  [ 79%]
tests/localization/test_fo.py .                                                                                  [ 79%]
tests/localization/test_fr.py ..                                                                                 [ 79%]
tests/localization/test_ko.py .                                                                                  [ 79%]
tests/localization/test_lt.py .                                                                                  [ 79%]
tests/parsing/test_parse_iso8601.py ...                                                                          [ 79%]
tests/parsing/test_parsing.py ....................                                                               [ 81%]
tests/parsing/test_parsing_duration.py ......                                                                    [ 82%]
tests/period/test_add_subtract.py .....                                                                          [ 82%]
tests/period/test_arithmetic.py ...                                                                              [ 83%]
tests/period/test_behavior.py ..                                                                                 [ 83%]
tests/period/test_construct.py ........                                                                          [ 83%]
tests/period/test_hashing.py ..                                                                                  [ 84%]
tests/period/test_range.py ..........                                                                            [ 85%]
tests/time/test_add.py ............                                                                              [ 86%]
tests/time/test_behavior.py .....                                                                                [ 86%]
tests/time/test_comparison.py ....................                                                               [ 88%]
tests/time/test_construct.py ..                                                                                  [ 88%]
tests/time/test_diff.py ....................................................                                     [ 93%]
tests/time/test_fluent_setters.py .                                                                              [ 93%]
tests/time/test_strings.py ......                                                                                [ 93%]
tests/time/test_sub.py .............                                                                             [ 95%]
tests/tz/test_helpers.py ...                                                                                     [ 95%]
tests/tz/test_local_timezone.py ..s                                                                              [ 95%]
tests/tz/test_timezone.py .....................................                                                  [ 99%]
tests/tz/test_timezones.py .F                                                                                    [ 99%]
tests/tz/zoneinfo/test_posix_timezone.py ...                                                                     [ 99%]
tests/tz/zoneinfo/test_reader.py .....                                                                           [100%]

======================================================= FAILURES =======================================================
_____________________________________________ test_timezones_are_loadable ______________________________________________

spec = ''

    def posix_spec(spec):  # type: (str) -> PosixTimezone
        try:
>           return _posix_spec(spec)

pendulum/tz/zoneinfo/posix_timezone.py:39: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

spec = ''

    def _posix_spec(spec):  # type: (str) -> PosixTimezone
        m = _spec.match(spec)
        if not m:
>           raise ValueError("Invalid posix spec")
E           ValueError: Invalid posix spec

pendulum/tz/zoneinfo/posix_timezone.py:47: ValueError

During handling of the above exception, another exception occurred:

    def test_timezones_are_loadable():
        zones = pendulum.timezones
    
        for zone in zones:
>           pendulum.timezone(zone)

tests/tz/test_timezones.py:16: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pendulum/tz/__init__.py:36: in timezone
    tz = _Timezone(name, extended=extended)
pendulum/tz/timezone.py:30: in __init__
    tz = read(name, extend=extended)
pendulum/tz/zoneinfo/__init__.py:9: in read
    return Reader(extend=extend).read_for(name)
pendulum/tz/zoneinfo/reader.py:46: in read_for
    return self.read(file_path)
pendulum/tz/zoneinfo/reader.py:58: in read
    return self._parse(fd)
pendulum/tz/zoneinfo/reader.py:113: in _parse
    trule = self._parse_posix_tz(fd)
pendulum/tz/zoneinfo/reader.py:211: in _parse_posix_tz
    return posix_spec(s)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

spec = ''

    def posix_spec(spec):  # type: (str) -> PosixTimezone
        try:
            return _posix_spec(spec)
        except ValueError:
>           raise InvalidPosixSpec(spec)
E           pendulum.tz.zoneinfo.exceptions.InvalidPosixSpec: Invalid POSIX spec:

pendulum/tz/zoneinfo/posix_timezone.py:41: InvalidPosixSpec
=================================================== warnings summary ===================================================
tests/formatting/test_formatter.py:241
  /home/altendky/pendulum/tests/formatting/test_formatter.py:241: DeprecationWarning: invalid escape sequence \[
    assert f.format(d, "[YYYY] YYYY \[YYYY\]") == "YYYY 2016 [2016]"

tests/formatting/test_formatter.py:242
  /home/altendky/pendulum/tests/formatting/test_formatter.py:242: DeprecationWarning: invalid escape sequence \D
    assert f.format(d, "\D D \\\D") == "D 28 \\28"

tests/datetime/test_from_format.py::test_from_format_with_escaped_elements
  /home/altendky/pendulum/pendulum/formatting/formatter.py:406: DeprecationWarning: Flags not at the start of the expression '(?P<YYYY>\\d{1,4}|\\d{' (truncated)
    if not re.match(pattern, time):

tests/datetime/test_from_format.py::test_from_format[Thursday 25th December 1975 02:15:16 PM -05:00-dddd Do MMMM YYYY hh:mm:ss A Z-1975-12-25T14:15:16-05:00-None]
  /home/altendky/pendulum/pendulum/formatting/formatter.py:406: DeprecationWarning: Flags not at the start of the expression '(?P<dddd>Sunday|Mond' (truncated)
    if not re.match(pattern, time):

-- Docs: https://docs.pytest.org/en/latest/warnings.html
============================= 1 failed, 1095 passed, 1 skipped, 4 warnings in 6.92 seconds =============================

Forgive my bypassing of poetry while messing with the pytz[data] versions and reporting here. I haven't used poetry really yet.

package versions
 ✘  ~/pendulum   masterpoetry run python -m pip freeze
appdirs==1.4.3
aspy.yaml==1.2.0
atomicwrites==1.3.0
attrs==19.1.0
Babel==2.6.0
black==18.9b0
CacheControl==0.12.5
cachy==0.2.0
certifi==2019.3.9
cfgv==1.5.0
chardet==3.0.4
cleo==0.6.8
Click==7.0
coverage==4.5.3
filelock==3.0.10
html5lib==1.0.1
identify==1.4.0
idna==2.8
importlib-metadata==0.8
jsonschema==3.0.1
lockfile==0.12.2
more-itertools==5.0.0
msgpack==0.6.1
nodeenv==1.3.3
pastel==0.1.0
pendulum==2.0.4
pkginfo==1.5.0.1
pluggy==0.9.0
poetry==0.12.11
pre-commit==1.14.4
py==1.8.0
pylev==1.3.0
pyparsing==2.3.1
pyrsistent==0.14.11
pytest==3.10.1
pytest-cov==2.6.1
python-dateutil==2.8.0
pytz==2018.9
pytzdata==2018.8
PyYAML==3.13
requests==2.21.0
requests-toolbelt==0.8.0
shellingham==1.3.0
six==1.12.0
toml==0.10.0
tomlkit==0.5.3
tox==3.7.0
urllib3==1.24.1
virtualenv==16.4.3
webencodings==0.5.1
zipp==0.3.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions