diff options
author | 2021-08-24 18:05:36 +0200 | |
---|---|---|
committer | 2021-08-25 00:20:46 +0100 | |
commit | a4c1a28f9377831cb3a5d292afb6e0fd12465b64 (patch) | |
tree | 50ab2eb0e3f310b80d9d5e5058d353b7ed139f1a /dev-python/parso | |
parent | dev-python/jedi: stable 0.17.2-r1 for hppa, bug #809113 (diff) | |
download | gentoo-a4c1a28f9377831cb3a5d292afb6e0fd12465b64.tar.gz gentoo-a4c1a28f9377831cb3a5d292afb6e0fd12465b64.tar.bz2 gentoo-a4c1a28f9377831cb3a5d292afb6e0fd12465b64.zip |
dev-python/parso: backport another test timing fix
Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python/parso')
-rw-r--r-- | dev-python/parso/files/parso-0.7.1-flaky-test.patch | 37 | ||||
-rw-r--r-- | dev-python/parso/parso-0.7.1-r1.ebuild | 5 |
2 files changed, 42 insertions, 0 deletions
diff --git a/dev-python/parso/files/parso-0.7.1-flaky-test.patch b/dev-python/parso/files/parso-0.7.1-flaky-test.patch new file mode 100644 index 000000000000..609918f31bb5 --- /dev/null +++ b/dev-python/parso/files/parso-0.7.1-flaky-test.patch @@ -0,0 +1,37 @@ +From 2799a7a3c2cf87fdc2d0c19a0890acea425091ce Mon Sep 17 00:00:00 2001 +From: Ivan Babrou <github@ivan.computer> +Date: Tue, 23 Feb 2021 22:27:05 -0800 +Subject: [PATCH] Fix flaky test_cache_last_used_update + +Sometimes time moves slowly and strict comparison is not enough: + +``` +> assert now < node_cache_item.last_used < time.time() +E assert 1614147958.869299 < 1614147958.869299 +E + where 1614147958.869299 = <parso.cache._NodeCacheItem object at 0x10456fe80>.last_used +E + and 1614147958.869299 = <built-in function time>() +E + where <built-in function time> = time.time + +test/test_cache.py:149: AssertionError +``` + +In particular, macOS timings can be a bit coarse. + +The test failure is from Apple Silicon M1. +--- + test/test_cache.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/test_cache.py b/test/test_cache.py +index bfdbaf5..f4291c2 100644 +--- a/test/test_cache.py ++++ b/test/test_cache.py +@@ -146,7 +146,7 @@ def test_cache_last_used_update(diff_cache, use_file_io): + parse('somecode2', cache=True, path=p, diff_cache=diff_cache) + + node_cache_item = next(iter(parser_cache.values()))[p] +- assert now < node_cache_item.last_used < time.time() ++ assert now <= node_cache_item.last_used <= time.time() + + + @skip_pypy diff --git a/dev-python/parso/parso-0.7.1-r1.ebuild b/dev-python/parso/parso-0.7.1-r1.ebuild index d9d01c91294a..74e95da16baf 100644 --- a/dev-python/parso/parso-0.7.1-r1.ebuild +++ b/dev-python/parso/parso-0.7.1-r1.ebuild @@ -18,6 +18,11 @@ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ppc ppc64 ~riscv sparc x86" distutils_enable_sphinx docs distutils_enable_tests pytest +PATCHES=( + "${FILESDIR}"/${P}-flaky-test.patch + "${FILESDIR}"/${PN}-0.8.2-flaky-test.patch +) + python_test() { local deselect=() [[ ${EPYTHON} == python3.10 ]] && deselect+=( |