diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-10-07 08:42:48 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-10-07 09:14:13 -0400 |
| commit | 0220b58917b5a979891b5765f6ac5095e0368489 (patch) | |
| tree | 2c914e75af50484b8e88603cfeab418e900fe4f2 /lib/sqlalchemy/testing | |
| parent | fc643ae73009e91e2dcff9ef57fb7dc0e48df88b (diff) | |
| download | sqlalchemy-0220b58917b5a979891b5765f6ac5095e0368489.tar.gz | |
Use monotonic time for pool age measurement
The internal clock used by the :class:`_pool.Pool` object is now
time.monotonic_time() under Python 3. Under Python 2, time.time() is still
used, which is legacy. This clock is used to measure the age of a
connection against its starttime, and used in comparisons against the
pool_timeout setting as well as the last time the pool was marked as
invalid to determine if the connection should be recycled. Previously,
time.time() was used which was subject to inaccuracies as a result of
system clock changes as well as poor time resolution on windows.
Change-Id: I94f90044c1809508e26a5a00134981c2a00d0405
Diffstat (limited to 'lib/sqlalchemy/testing')
| -rw-r--r-- | lib/sqlalchemy/testing/requirements.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index 45a2fdf31..e2c61a05e 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -15,7 +15,6 @@ to provide specific inclusion/exclusions. """ -import platform import sys from . import exclusions @@ -1093,11 +1092,22 @@ class SuiteRequirements(Requirements): def _running_on_windows(self): return exclusions.LambdaPredicate( - lambda: platform.system() == "Windows", + lambda: util.win32, description="running on Windows", ) @property + def millisecond_monotonic_time(self): + """the util.monotonic_time() function must be millisecond accurate. + + Under Python 2 we can't guarantee this on Windows. + + """ + return exclusions.skip_if( + lambda: util.win32 and sys.version_info < (3,) + ) + + @property def timing_intensive(self): return exclusions.requires_tag("timing_intensive") |
