1 |
commit: a4c1a28f9377831cb3a5d292afb6e0fd12465b64 |
2 |
Author: Rolf Eike Beer <eike <AT> sf-mail <DOT> de> |
3 |
AuthorDate: Tue Aug 24 16:05:36 2021 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Aug 24 23:20:46 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a4c1a28f |
7 |
|
8 |
dev-python/parso: backport another test timing fix |
9 |
|
10 |
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de> |
11 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
12 |
|
13 |
.../parso/files/parso-0.7.1-flaky-test.patch | 37 ++++++++++++++++++++++ |
14 |
dev-python/parso/parso-0.7.1-r1.ebuild | 5 +++ |
15 |
2 files changed, 42 insertions(+) |
16 |
|
17 |
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 |
18 |
new file mode 100644 |
19 |
index 00000000000..609918f31bb |
20 |
--- /dev/null |
21 |
+++ b/dev-python/parso/files/parso-0.7.1-flaky-test.patch |
22 |
@@ -0,0 +1,37 @@ |
23 |
+From 2799a7a3c2cf87fdc2d0c19a0890acea425091ce Mon Sep 17 00:00:00 2001 |
24 |
+From: Ivan Babrou <github@××××.computer> |
25 |
+Date: Tue, 23 Feb 2021 22:27:05 -0800 |
26 |
+Subject: [PATCH] Fix flaky test_cache_last_used_update |
27 |
+ |
28 |
+Sometimes time moves slowly and strict comparison is not enough: |
29 |
+ |
30 |
+``` |
31 |
+> assert now < node_cache_item.last_used < time.time() |
32 |
+E assert 1614147958.869299 < 1614147958.869299 |
33 |
+E + where 1614147958.869299 = <parso.cache._NodeCacheItem object at 0x10456fe80>.last_used |
34 |
+E + and 1614147958.869299 = <built-in function time>() |
35 |
+E + where <built-in function time> = time.time |
36 |
+ |
37 |
+test/test_cache.py:149: AssertionError |
38 |
+``` |
39 |
+ |
40 |
+In particular, macOS timings can be a bit coarse. |
41 |
+ |
42 |
+The test failure is from Apple Silicon M1. |
43 |
+--- |
44 |
+ test/test_cache.py | 2 +- |
45 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
46 |
+ |
47 |
+diff --git a/test/test_cache.py b/test/test_cache.py |
48 |
+index bfdbaf5..f4291c2 100644 |
49 |
+--- a/test/test_cache.py |
50 |
++++ b/test/test_cache.py |
51 |
+@@ -146,7 +146,7 @@ def test_cache_last_used_update(diff_cache, use_file_io): |
52 |
+ parse('somecode2', cache=True, path=p, diff_cache=diff_cache) |
53 |
+ |
54 |
+ node_cache_item = next(iter(parser_cache.values()))[p] |
55 |
+- assert now < node_cache_item.last_used < time.time() |
56 |
++ assert now <= node_cache_item.last_used <= time.time() |
57 |
+ |
58 |
+ |
59 |
+ @skip_pypy |
60 |
|
61 |
diff --git a/dev-python/parso/parso-0.7.1-r1.ebuild b/dev-python/parso/parso-0.7.1-r1.ebuild |
62 |
index d9d01c91294..74e95da16ba 100644 |
63 |
--- a/dev-python/parso/parso-0.7.1-r1.ebuild |
64 |
+++ b/dev-python/parso/parso-0.7.1-r1.ebuild |
65 |
@@ -18,6 +18,11 @@ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ppc ppc64 ~riscv sparc x86" |
66 |
distutils_enable_sphinx docs |
67 |
distutils_enable_tests pytest |
68 |
|
69 |
+PATCHES=( |
70 |
+ "${FILESDIR}"/${P}-flaky-test.patch |
71 |
+ "${FILESDIR}"/${PN}-0.8.2-flaky-test.patch |
72 |
+) |
73 |
+ |
74 |
python_test() { |
75 |
local deselect=() |
76 |
[[ ${EPYTHON} == python3.10 ]] && deselect+=( |