summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zoneinfo
Commit message (Collapse)AuthorAgeFilesLines
* gh-106233: Fix stacklevel in zoneinfo.InvalidTZPathWarning (GH-106234)Nikita Sobolev2024-02-061-2/+15
|
* GH-44626, GH-105476: Fix `ntpath.isabs()` handling of part-absolute paths ↵Barney Gale2024-01-131-12/+13
| | | | | | | | | | | | | (#113829) On Windows, `os.path.isabs()` now returns `False` when given a path that starts with exactly one (back)slash. This is more compatible with other functions in `os.path`, and with Microsoft's own documentation. Also adjust `pathlib.PureWindowsPath.is_absolute()` to call `ntpath.isabs()`, which corrects its handling of partial UNC/device paths like `//foo`. Co-authored-by: Jon Foster <jon@jon-foster.co.uk>
* gh-81682: Fix test failures when CPython is built without docstrings (GH-113410)Serhiy Storchaka2023-12-231-0/+3
|
* gh-110974: Make sure all test_zoneinfo tests are collected (GH-110975)Nikita Sobolev2023-10-211-2/+5
| | | | | Test classes from the test_zoneinfo submodule were overridden by test classes from the test_zoneinfo_property submodule with the same name.
* bpo-42663: Fix parsing TZ strings in zoneinfo module (GH-23825)Serhiy Storchaka2023-10-141-7/+118
| | | | | | | zipinfo now supports the full range of values in the TZ string determined by RFC 8536 and detects all invalid formats. Both Python and C implementations now raise exceptions of the same type on invalid data.
* GH-86275: Implementation of hypothesis stubs for property-based tests, with ↵Paul Ganssle2023-05-122-0/+369
| | | | | | | | | | | | | zoneinfo tests (#22863) These are stubs to be used for adding hypothesis (https://hypothesis.readthedocs.io/en/latest/) tests to the standard library. When the tests are run in an environment where `hypothesis` and its various dependencies are not installed, the stubs will turn any tests with examples into simple parameterized tests and any tests without examples are skipped. It also adds hypothesis tests for the `zoneinfo` module, and a Github Actions workflow to run the hypothesis tests as a non-required CI job. The full hypothesis interface is not stubbed out — missing stubs can be added as necessary. Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
* GH-102537: Handle check for PYTHONTZPATH failing in zoneinfo test (GH-102538)Paul Ganssle2023-03-101-1/+8
| | | | | It is possible but unlikely for the `python_tzpath_context` function to fail between the start of the `try` block and the point where `os.environ.get` succeeds, in which case `old_env` will be undefined. In this case, we want to take no action. Practically speaking this will really only happen in an error condition anyway, so it doesn't really matter, but we should probably do it right anyway.
* gh-99138: Isolate _zoneinfo (#99218)Erlend E. Aasland2023-02-151-3/+1
| | | | * Convert zone info type to heap type and add it to module state * Add global variables to module state
* gh-97955: Migrate `zoneinfo` to Argument Clinic (#97958)Nikita Sobolev2022-10-071-0/+13
|
* bpo-46425: fix direct invocation of `test_fileutils` and `test_zoneinfo` ↵Nikita Sobolev2022-01-221-2/+6
| | | | (GH-30792)
* bpo-45577: test all pickle protocols in `test_zoneinfo` (GH-29167)Nikita Sobolev2021-10-281-44/+53
|
* bpo-41025: Fix subclassing for zoneinfo.ZoneInfo (GH-20965)Paul Ganssle2020-08-141-2/+2
| | | | | | | | Prior to this change, attempting to subclass the C implementation of zoneinfo.ZoneInfo gave the following error: TypeError: unbound method ZoneInfo.__init_subclass__() needs an argument https://bugs.python.org/issue41025
* bpo-40275: Use new test.support helper submodules in tests (GH-21764)Hai Shi2020-08-071-1/+1
|
* bpo-41371: Handle lzma lib import error in test_zoneinfo.py (GH-21734)Nathan M2020-08-061-1/+2
|
* Further de-linting of zoneinfo module (#20499)Paul Ganssle2020-05-291-9/+2
| | | | | | | * Remove unused imports in zoneinfo * Remove unused variables in zoneinfo * Remove else after raise
* bpo-40536: Add zoneinfo.available_timezones (GH-20158)Paul Ganssle2020-05-182-2/+138
| | | | | This was not specified in the PEP, but it will likely be a frequently requested feature if it's not included. This includes only the "canonical" zones, not a simple listing of every valid value of `key` that can be passed to `Zoneinfo`, because it seems likely that that's what people will want.
* bpo-40503: PEP 615: Tests and implementation for zoneinfo (GH-19909)Paul Ganssle2020-05-166-0/+2386
This is the initial implementation of PEP 615, the zoneinfo module, ported from the standalone reference implementation (see https://www.python.org/dev/peps/pep-0615/#reference-implementation for a link, which has a more detailed commit history). This includes (hopefully) all functional elements described in the PEP, but documentation is found in a separate PR. This includes: 1. A pure python implementation of the ZoneInfo class 2. A C accelerated implementation of the ZoneInfo class 3. Tests with 100% branch coverage for the Python code (though C code coverage is less than 100%). 4. A compile-time configuration option on Linux (though not on Windows) Differences from the reference implementation: - The module is arranged slightly differently: the accelerated module is `_zoneinfo` rather than `zoneinfo._czoneinfo`, which also necessitates some changes in the test support function. (Suggested by Victor Stinner and Steve Dower.) - The tests are arranged slightly differently and do not include the property tests. The tests live at test/test_zoneinfo/test_zoneinfo.py rather than test/test_zoneinfo.py or test/test_zoneinfo/__init__.py because we may do some refactoring in the future that would likely require this separation anyway; we may: - include the property tests - automatically run all the tests against both pure Python and C, rather than manually constructing C and Python test classes (similar to the way this works with test_datetime.py, which generates C and Python test cases from datetimetester.py). - This includes a compile-time configuration option on Linux (though not on Windows); added with much help from Thomas Wouters. - Integration into the CPython build system is obviously different from building a standalone zoneinfo module wheel. - This includes configuration to install the tzdata package as part of CI, though only on the coverage jobs. Introducing a PyPI dependency as part of the CI build was controversial, and this is seen as less of a major change, since the coverage jobs already depend on pip and PyPI. Additional changes that were introduced as part of this PR, most / all of which were backported to the reference implementation: - Fixed reference and memory leaks With much debugging help from Pablo Galindo - Added smoke tests ensuring that the C and Python modules are built The import machinery can be somewhat fragile, and the "seamlessly falls back to pure Python" nature of this module makes it so that a problem building the C extension or a failure to import the pure Python version might easily go unnoticed. - Adjustments to zoneinfo.__dir__ Suggested by Petr Viktorin. - Slight refactorings as suggested by Steve Dower. - Removed unnecessary if check on std_abbr Discovered this because of a missing line in branch coverage.