summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_time.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (#30913)Nikita Sobolev2022-01-281-12/+18
|
* bpo-43869: Time Epoch is the same on all platforms (GH-30664)Victor Stinner2022-01-191-0/+7
|
* bpo-46099: Fix pthread_getcpuclockid test on Solaris (GH-30140)Jakub Kulík2021-12-181-5/+6
| | | Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* Fix typos in the Lib directory (GH-28775)Christian Clauss2021-10-061-2/+2
| | | | | Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-41710: Add _PyTime_AsTimespec_clamp() (GH-28629)Victor Stinner2021-09-301-1/+48
| | | | | | | | | | | | | | | Add the _PyTime_AsTimespec_clamp() function: similar to _PyTime_AsTimespec(), but clamp to _PyTime_t min/max and don't raise an exception. PyThread_acquire_lock_timed() now uses _PyTime_AsTimespec_clamp() to remove the Py_UNREACHABLE() code path. * Add _PyTime_AsTime_t() function. * Add PY_TIME_T_MIN and PY_TIME_T_MAX constants. * Replace _PyTime_AsTimeval_noraise() with _PyTime_AsTimeval_clamp(). * Add pytime_divide_round_up() function. * Fix integer overflow in pytime_divide(). * Add pytime_divmod() function.
* bpo-41100: Support macOS 11 and Apple Silicon (GH-22855)Ronald Oussoren2020-11-081-0/+30
| | | | | | | | | | | Co-authored-by: Lawrence D’Anna <lawrence_danna@apple.com> * Add support for macOS 11 and Apple Silicon (aka arm64) As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy * Support building on recent versions of macOS while deploying to older versions This allows building installers on macOS 11 while still supporting macOS 10.9.
* bpo-40275: Use new test.support helper submodules in tests (GH-21219)Hai Shi2020-06-301-1/+2
|
* Remove binding of captured exceptions when not used to reduce the chances of ↵Pablo Galindo2019-11-191-1/+1
| | | | | | | creating cycles (GH-17246) Capturing exceptions into names can lead to reference cycles though the __traceback__ attribute of the exceptions in some obscure cases that have been reported previously and fixed individually. As these variables are not used anyway, we can remove the binding to reduce the chances of creating reference cycles. See for example GH-13135
* bpo-37552: Skip failing tests in strptime/strftime with UCRT version ↵Paul Monson2019-07-181-0/+3
| | | | | 17763.615 (#14460) A bug in MSVC UCRT version 17763.615 (which has been fixed in newer versions) is causing test failures in some strptime/strftime tests when the default code page is c65001. This change selectively skips the tests affected by this.
* bpo-36895: remove time.clock() as per removal notice. (GH-13270)Matthias Bussonnier2019-05-131-18/+1
| | | | `time.clock()` was deprecated in 3.3, and marked for removal removal in 3.8; this thus remove it from the time module.
* bpo-36454: Fix test_time.test_monotonic() (GH-12929)Victor Stinner2019-04-231-2/+3
| | | | | Change test_time.test_monotonic() to test only the lower bound of elapsed time after a sleep command rather than the upper bound. This prevents unnecessary test failures on slow buildbots. Patch by Victor Stinner.
* bpo-31904: Port the time module on VxWorks (GH-12305)pxinwr2019-04-151-1/+5
| | | time.clock() is not available on VxWorks.
* bpo-34373: fix test_mktime and test_pthread_getcpuclickid tests on AIX (GH-8726)Michael Felt2018-12-281-8/+7
| | | | | | | | | * Fix test_mktime on AIX by adding code to get mktime to behave the same way as it does on other *nix systems * Fix test_pthread_getcpuclickid in AIX by adjusting the test case expectations when running on AIX in 32-bit mode Patch by Michael Felt.
* bpo-33723: Remove busy loop from test_time (GH-10773)Victor Stinner2018-11-281-47/+0
| | | | The "busy loops" of test_process_time() and test_thread_time() are not reliable and fail randomly on Windows: remove them.
* bpo-33723: Fix test_time.test_thread_time() (GH-10724)Victor Stinner2018-11-261-3/+7
| | | Tolerate up to 30 ms, instead of 15 min, in other threads.
* bpo-35202: Remove unused imports in tests. (GH-10561)Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి)2018-11-161-1/+0
|
* closes bpo-34654: Tolerate + at the beginning of large years. (GH-9238)Benjamin Peterson2018-09-121-3/+3
|
* bpo-13312: Avoid int underflow in time year. (GH-8912)Gregory P. Smith2018-08-251-6/+5
| | | Avoids an integer underflow in the time module's year handling code.
* bpo-34179: Make sure decimal context doesn't affect other tests. (#8376)Bo Bayles2018-07-211-13/+13
|
* bpo-33723: Fix test_time.test_process_time() (GH-8358)Victor Stinner2018-07-211-4/+9
| | | | | | The test failed on my laptop because the busy loop took 15.9 ms whereas the test expects at least 20 ms. Modify test_process_time() as test_thread_time() has been modified recently: only require 15 ms instead of 20 ms.
* bpo-33723: Fix test_time.test_thread_time() (GH-8267)Victor Stinner2018-07-121-4/+9
| | | | | | The test failed on AMD64 Debian root 3.x buildbot because the busy loop of 100 ms only increased time.thread_time() by 19.9 ms which is smaller than 20 ms. Modify the test to tolerate a delta of at least 15 ms instead of 20 ms.
* bpo-32025: Add time.thread_time() (#4410)Antoine Pitrou2017-11-151-0/+57
| | | | | | | | | | | | | | * bpo-32025: Add time.thread_time() * Add missing #endif * Add NEWS blurb * Add docs and whatsnew * Address review comments * Review comments
* bpo-31784: Implement PEP 564: add time.time_ns() (#3989)Victor Stinner2017-11-021-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | Add new time functions: * time.clock_gettime_ns() * time.clock_settime_ns() * time.monotonic_ns() * time.perf_counter_ns() * time.process_time_ns() * time.time_ns() Add new _PyTime functions: * _PyTime_FromTimespec() * _PyTime_FromNanosecondsObject() * _PyTime_FromTimeval() Other changes: * Add also os.times() tests to test_os. * pytime_fromtimeval() and pytime_fromtimeval() now return _PyTime_MAX or _PyTime_MIN on overflow, rather than undefined behaviour * _PyTime_FromNanoseconds() parameter type changes from long long to _PyTime_t
* time.clock() now emits a DeprecationWarning (GH-4020)Victor Stinner2017-10-171-10/+12
| | | | | | | | | | bpo-31803: time.clock() and time.get_clock_info('clock') now emit a DeprecationWarning warning. Replace time.clock() with time.perf_counter() in tests and demos. Remove also hasattr(time, 'monotonic') in test_time since time.monotonic() is now always available since Python 3.5.
* bpo-31786: Make functions in the select module blocking when timeout is a ↵Pablo Galindo2017-10-171-0/+3
| | | | small negative value. (#4003)
* weaken pthread_getcpuclockid test (more bpo-31596) (#3904)Benjamin Peterson2017-10-061-8/+1
| | | There just isn't much we can assert in a portable way.
* closes bpo-31596: Add an interface for pthread_getcpuclockid(3) (#3756)pdox2017-10-051-0/+20
|
* bpo-26669: Fix nan arg value error in pytime.c (#3085)Han Lee2017-09-081-0/+29
| | | | | | | | | | * Fix #26669 * Modify NaN check function and error message * Fix pytime.c when arg is nan * fix whitespace
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-4/+0
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* [security] bpo-13617: Reject embedded null characters in wchar* strings. (#2302)Serhiy Storchaka2017-06-281-0/+4
| | | | | | | Based on patch by Victor Stinner. Add private C API function _PyUnicode_AsUnicode() which is similar to PyUnicode_AsUnicode(), but checks for null characters.
* Fix typo in test_time.pyVictor Stinner2016-08-171-1/+1
|
* pytime: add _PyTime_check_mul_overflow() macro to avoid undefined behaviourVictor Stinner2015-09-101-1/+2
| | | | | | | | | | | Overflow test in test_FromSecondsObject() fails on FreeBSD 10.0 buildbot which uses clang. clang implements more aggressive optimization which gives different result than GCC on undefined behaviours. Check if a multiplication will overflow, instead of checking if a multiplicatin had overflowed, to avoid undefined behaviour. Add also debug information if the test on overflow fails.
* Fix test_time on platform with 32-bit time_t typeVictor Stinner2015-09-101-3/+6
| | | | Filter also values for check_float_rounding().
* Fix test_time on platform with 32-bit time_t typeVictor Stinner2015-09-101-5/+18
| | | | Filter values which would overflow when converted to a C time_t type.
* Fix test_time on WindowsVictor Stinner2015-09-101-9/+24
| | | | | | | * Filter values which would overflow on conversion to the C long type (for timeval.tv_sec). * Adjust also the message of OverflowError on PyTime conversions * test_time: add debug information if a timestamp conversion fails
* test_time: rewrite PyTime API rounding testsVictor Stinner2015-09-091-562/+234
| | | | | | | | | | Drop all hardcoded tests. Instead, reimplement each function in Python, usually using decimal.Decimal for the rounding mode. Add much more values to the dataset. Test various timestamp units from picroseconds to seconds, in integer and float. Enhance also _PyTime_AsSecondsDouble().
* Issue #23517: fromtimestamp() and utcfromtimestamp() methods ofVictor Stinner2015-09-081-135/+110
| | | | | | | | | | | | datetime.datetime now round microseconds to nearest with ties going to nearest even integer (ROUND_HALF_EVEN), as round(float), instead of rounding towards -Infinity (ROUND_FLOOR). pytime API: replace _PyTime_ROUND_HALF_UP with _PyTime_ROUND_HALF_EVEN. Fix also _PyTime_Divide() for negative numbers. _PyTime_AsTimeval_impl() now reuses _PyTime_Divide() instead of reimplementing rounding modes.
* Merge from 3.5Steve Dower2015-09-071-0/+13
|\
| * Issue #24917: time_strftime() buffer over-read.Steve Dower2015-09-071-0/+13
| |
| * Backing out 09b62202d9b7; the tests fail on Linux, and it needs a re-think.Larry Hastings2015-09-061-6/+0
| |
* | Issue #24917: Backed out changeset 09b62202d9b7Steve Dower2015-09-061-6/+0
|\ \
| * \ Issue #24917: Backed out changeset 09b62202d9b7Steve Dower2015-09-061-6/+0
| |\ \ | | |/ | |/|
* | | Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch.Steve Dower2015-09-061-0/+6
|\ \ \ | |/ /
| * | Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch.Steve Dower2015-09-051-0/+6
| | |
* | | Issue #23517: Fix implementation of the ROUND_HALF_UP rounding mode inVictor Stinner2015-09-041-6/+7
| | | | | | | | | | | | | | | datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp(). microseconds sign should be kept before rounding.
* | | test_time: add tests on HALF_UP rounding mode for _PyTime_ObjectToTime_t() andVictor Stinner2015-09-041-40/+90
| | | | | | | | | | | | _PyTime_ObjectToTimespec()
* | | Issue #23517: test_time, skip a test checking a corner case on floating pointVictor Stinner2015-09-021-1/+3
| | | | | | | | | | | | rounding
* | | test_time: add more tests on HALF_UP rounding modeVictor Stinner2015-09-021-8/+28
| | |
* | | Issue #23517: Reintroduce unit tests for the old PyTime API since it's stillVictor Stinner2015-09-021-0/+154
| | | | | | | | | | | | used.
* | | Issue #23517: Add "half up" rounding mode to the _PyTime APIVictor Stinner2015-09-011-3/+61
|/ /