summaryrefslogtreecommitdiff
path: root/dateutil
Commit message (Collapse)AuthorAgeFilesLines
* Move to src layoutMario Corchero2021-07-1634-18398/+0
| | | | | Move the project to the src layout to ensure we are testing on the generated package rather than the checked out source tree.
* Fix typo discovered by codespellChristian Clauss2021-07-161-1/+1
|
* Lazy-load submodules in Python 3.7+orson2021-07-162-0/+80
| | | | | This uses PEP 562 to implement lazy loading of submodules in dateutil (GH-771).
* Merge pull request #1056 from ffe4/issue_1029Mario Corchero2021-07-051-0/+9
|\ | | | | Add and xfail unhandled case #1029
| * Add and xfail unhandled case #1029Daniel Lemm2020-06-181-0/+9
| |
* | Merge pull request #978 from jpurviance/utils-pytestMario Corchero2021-07-052-149/+158
|\ \ | | | | | | Migrate away from unittest and adopt pytest
| * | tests: Move tests towards pytest style and away from unittestJohn Purviance2021-07-052-149/+158
| | | | | | | | | | | | Part of a series of commit that is moving the suite.
* | | Merge pull request #977 from jpurviance/internals-pytestMario Corchero2021-07-051-24/+20
|\ \ \ | | | | | | | | migrate away from unittest and adopt pytest for test_internals.py
| * | | migrate away from unittest and adopt pytest for test_internals.pyJohn Purviance2019-11-241-24/+20
| | | |
* | | | Merge pull request #1125 from mariocj89/pu/strict-iso-sepMario Corchero2021-07-022-26/+12
|\ \ \ \ | |_|/ / |/| | | isoparse: Fail with inconsistent time separators
| * | | tests: Fix typo in `test_isotime_raises`Mario Corchero2021-05-191-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | The test was meant to validate `parse_isodate` but was using `parse_isotime` instead. Move the test case to the list validating invalid formats.
| * | | isoparse: Fail with inconsistent time separatorsMario Corchero2021-05-192-16/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fail when separators are used inconsistently to split the time porting of a string. Even if more restrictive, we have warned that we were going to fail on invalid cases of ISO formatted strings. This will prevent invalid iso formatted strings from being unexpectedly parsed.
* | | | Merge pull request #1060 from frenzymadness/decodeMario Corchero2021-05-211-8/+2
|\ \ \ \ | | | | | | | | | | Call .decode() only for binary data
| * | | | Simplify parser._timelex handling of bytes and bytearrayLumir Balhar2021-05-201-8/+2
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | We can handle both bytes and bytearray in the same way in Python 2 and Python 3. Co-authored-by: Mario Corchero <mariocj89@gmail.com>
* | | | tests: Add additional tests for relative delta and FebruaryRobin Henriksson Törnström2021-05-211-0/+8
| | | |
* | | | tests: Fix typo in test nameRobin Henriksson Törnström2021-05-211-1/+1
| | | |
* | | | Decode input str when reporting an error in `parse_isodate`Paul Brown2021-05-202-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the function is wrapped around a decorator that converts the input to bytes, when an exception is raised that includes the value, it contains the value as bytes (b"<val>"). To provide the expected str in Python 3, decode that to unicode. This will result in `u""` for Python 2 callers, but given that we plan to drop support for Python 2 in the short term, it feels acceptable.
* | | | Use already existing `str_len` in isoparseArcLightSlavik2021-05-201-1/+1
| |/ / |/| | | | | | | | Save an unnecessary len call.
* | | Merge pull request #1128 from mariocj89/pu/tzdataPaul Ganssle2021-05-191-0/+0
|\ \ \ | | | | | | | | Update zoneinfo to 2021a
| * | | Update zoneinfo to 2021aMario Corchero2021-05-181-0/+0
| | | |
* | | | tests: Fix logic on detecting platform support for `-d`Mario Corchero2021-05-181-3/+4
|/ / / | | | | | | | | | | | | | | | Tests are failing in CI on pypi for windows. The function is returning an empty string rather than raising. This commit adapts the logic to skip those cases.
* | | Use fat zic binaries in zoneinfo.rebuildPaul Ganssle2020-08-281-6/+28
|/ / | | | | | | | | | | | | At the moment, we do not support Version 2 files (see GH-590), and many zones will be inaccurate *today* when dateutil.tz is used with a slim binary. For the moment, we'll force fat binaries. In the long term, we'll migrate to something like zoneinfo.
* | Added property test for tz.gettz()Daniel Lemm2020-04-242-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | The current tests only check that `tz.gettz()` and `tz.gettz("")` do the same thing, but not that the thing that they do is equivalent to a local time zone. Defining what is a "local time" is a bit complicated, considering that `tz.gettz()` may return a `tzfile` or a `tzlocal`, and neither of those have the same behavior as Python's built-in local time support via `.astimezone()`. This property test checks only the datetimes and properties that are expected to be the same between the various methods of getting a "local" time zone.
* | Fix tz.gettz() behavior with empty stringDaniel Lemm2020-04-242-1/+10
| | | | | | | | | | | | | | | | | | | | The documented behavior of the function is to return a local time zone when the argument is None or an empty string. This was working if the TZ environment variable was set, but not working otherwise. Fixes #925, #926
* | Merge pull request #986 from timgates42/bugfix/typo_negligiblePaul Ganssle2020-04-241-1/+1
|\ \ | | | | | | Fix simple typo: negilible -> negligible
| * | Fix simple typo: negilible -> negligibleTim Gates2020-04-241-1/+1
| | | | | | | | | | | | Closes GH-985
* | | Merge pull request #1034 from pganssle/2020aPaul Ganssle2020-04-241-0/+0
|\ \ \ | |/ / |/| | Update zoneinfo to 2020a
| * | Update zoneinfo to 2020aPaul Ganssle2020-04-241-0/+0
| | |
* | | Wrap _invalidates_cache decorator to preserve docstringDaniel Lemm2020-04-051-10/+12
|/ / | | | | | | | | autodoc will inspect the __doc__ attribute of the method. Since the decorator replaces the original method we use functools.wrap to copy __doc__.
* | Fix numbered list formattingHugo van Kemenade2020-04-041-6/+6
| |
* | Fix Easter typosHugo van Kemenade2020-04-041-2/+2
| |
* | Improve documentation for parser errors/warningsPaul Ganssle2020-01-021-2/+11
| |
* | Document that parser.parse raises ParserErrorPaul Ganssle2020-01-021-4/+4
| |
* | Update documentation linksPaul Ganssle2020-01-021-3/+3
| | | | | | | | | | Periodic update of all links that point to redirects or http targets when an https target is available.
* | Fix custom repr for ParserErrorPaul Ganssle2020-01-022-2/+12
| | | | | | | | | | | | | | | | | | | | This was originally dead code, because an indentation error had `__repr__` defined after the `return` statement in `__str__`. The definition of the `__repr__` is also changed to be more in line with the conception of a repr as "what you would have to evalue to get this object". Even though this is not guaranteed behavior, this commit also adds a regression test to avoid simple errors like this in the future.
* | Fix TypeError in parser wrapper logicMark Bailey2020-01-022-1/+5
|/ | | | | | | | | | | In attempting to pass-through the string representation of an exception we are wrapping, we made the erroneous assumption that `args[0]` would always be a string (or something that can concatenate cleanly with a string). This turns out not to be the case with `IllegalMonthError`, where it is an integer, so to avoid raising an erroneous `TypeError`, we first convert the wrapped exception to a string. See GH issue #981.
* Lock around strong cache updatesPaul Ganssle2019-11-021-11/+18
| | | | | | | | | Since the strong cache uses operations in OrderedDict that are not thread-safe in Python 2, it is necessary to acquire a lock while updating the dictionary. When Python 2 support is dropped, we can likely refactor this to avoid locking.
* Fix test_tzlocal_offset_equal[GMT-tzoff1]Kubilay Kocak2019-11-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | test_tzlocal_offset_equal[GMT-tzoff1] fails if a system does not have a defined (installed) GMT timezone, for example if "Link Etc/GMT GMT" is not defined in the zoneinfo configuration: > assert tz.tzlocal() == tzoff E AssertionError: assert tzlocal() == tzoffset(u'GMT', 0) E -tzlocal() E +tzoffset(u'GMT', 0) An example of such a configuration is FreeBSD, who's default timezone is UTC [1][2]. This configuration results in any "non-present" or undefined TZ name being returned/processed as the default timezone name (in FreeBSD's case, UTC). Further, POSIX does not recognize [3] TZ=GMT or TZ=UTC as valid values because they neither start with a colon nor contain a numeric offset hour field. Accordingly, update the GMT value for this parametrized test to GMT0, a specific (not aliased) timezone, making it more robust to system configuration differences. [1] https://svnweb.freebsd.org/changeset/base/130332 [2] https://svnweb.freebsd.org/changeset/base/199405 [3] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
* Auto-skip tests when TZ can't be changed.Alexander Shadchin2019-11-022-9/+7
| | | | | | At the moment these tests are skipped ad-hoc in the test suite, but we can use `pytest.skip` in the context manager itself to skip them automatically and make things easier on ourselves.
* Merge pull request #935 from labrys/patch-1Paul Ganssle2019-11-022-2/+39
|\ | | | | Fix error message for gettz when passed bytes
| * Add tests for gettz zone supports startswithLabrys of Knossos2019-11-021-0/+30
| |
| * Add helpful message when passed bytes to gettzLabrys of Knossos2019-11-021-2/+9
| | | | | | | | Fixes #927
* | Remove WarningTestMixin in favor of pytest.warnsPaul Ganssle2019-11-024-64/+16
|/ | | | | | This was originally added when we were still supporting unittest-only tests, but now that we require pytest, we can switch over to using the built-in pytest.warns context manager.
* Fix incorrect import in Python 3.7+Paul Ganssle2019-09-221-1/+1
| | | | | | | | | | | | It turns out that the import of `contextlib.nullcontext` in Python 3.7+ was accidentally trying to import `contextmanager.nullcontext`, but this was never noticed because it simply fell back to the backport included here. I do not know of a great way to test this that doesn't rely on implementation details, but I have manually tested it by setting a breakpoint after the import in the `try` statement and importing `dateutil.tz` manually on Python 3.7, so this version should work.
* Update tzdata to 2019cPaul Ganssle2019-09-191-0/+0
|
* Fixes for a potential Python 4 (#950)Hugo van Kemenade2019-08-273-7/+7
| | | Changed compatibility logic to support a potential Python 4.0 release.
* Fix typos in comments and documentationHugo2019-08-2710-14/+14
| | | | | Fixes several misspellings, typos and styling errors (e.g. github -> GitHub) in the comments and documentation.
* Update tzdata to 2019bPaul Ganssle2019-07-061-0/+0
|
* Use tz.UTC in testsPaul Ganssle2019-04-234-10/+10
|
* Remove unnecessary tzutc() calls in tzPaul Ganssle2019-04-231-2/+2
|