public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/parso/, dev-python/parso/files/
@ 2021-06-30 12:21 Michał Górny
  0 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2021-06-30 12:21 UTC (permalink / raw
  To: gentoo-commits

commit:     6e1f809fe03d991efebde1c28d2f198ad5c63250
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 30 11:24:38 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun 30 12:21:14 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e1f809f

dev-python/parso: Port to py3.10

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/parso/files/parso-0.8.2-py310.patch | 29 ++++++++++++++++++++++++++
 dev-python/parso/parso-0.8.2.ebuild            | 18 ++++++++++++++--
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/dev-python/parso/files/parso-0.8.2-py310.patch b/dev-python/parso/files/parso-0.8.2-py310.patch
new file mode 100644
index 00000000000..2f3487dd2f6
--- /dev/null
+++ b/dev-python/parso/files/parso-0.8.2-py310.patch
@@ -0,0 +1,29 @@
+From cbb61fb81955a8cdbb5cdeedc9bcfffa39a5f270 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Thu, 22 Apr 2021 21:04:49 +0200
+Subject: [PATCH] Relax a test regex to match new enum repr in Python 3.10.0a7+
+ (#186)
+
+bpo-40066: Enum: adjust repr() to show only enum and member name (not value,
+nor angle brackets) and str() to show only member name.
+https://bugs.python.org/issue40066
+---
+ test/test_pgen2.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/test_pgen2.py b/test/test_pgen2.py
+index 9b0dd34..85ccacf 100644
+--- a/test/test_pgen2.py
++++ b/test/test_pgen2.py
+@@ -339,7 +339,7 @@ def test_left_recursion():
+ @pytest.mark.parametrize(
+     'grammar, error_match', [
+         ['foo: bar | baz\nbar: NAME\nbaz: NAME\n',
+-         r"foo is ambiguous.*given a PythonTokenTypes\.NAME.*bar or baz"],
++         r"foo is ambiguous.*given a (PythonTokenTypes\.)?NAME.*bar or baz"],
+         ['''foo: bar | baz\nbar: 'x'\nbaz: "x"\n''',
+          r"foo is ambiguous.*given a ReservedString\(x\).*bar or baz"],
+         ['''foo: bar | 'x'\nbar: 'x'\n''',
+-- 
+2.32.0
+

diff --git a/dev-python/parso/parso-0.8.2.ebuild b/dev-python/parso/parso-0.8.2.ebuild
index 3ceece3224e..8ab7282e6cf 100644
--- a/dev-python/parso/parso-0.8.2.ebuild
+++ b/dev-python/parso/parso-0.8.2.ebuild
@@ -1,9 +1,9 @@
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
-PYTHON_COMPAT=( python3_{7..9} pypy3 )
+PYTHON_COMPAT=( python3_{8..10} pypy3 )
 
 inherit distutils-r1
 
@@ -17,3 +17,17 @@ KEYWORDS="amd64 ~arm arm64 ~ppc ppc64 ~riscv ~sparc x86"
 
 distutils_enable_sphinx docs
 distutils_enable_tests pytest
+
+PATCHES=(
+	"${FILESDIR}"/${P}-py310.patch
+)
+
+python_test() {
+	local deselect=()
+	[[ ${EPYTHON} == python3.10 ]] && deselect+=(
+		# py3.10 changed exception messages
+		test/test_python_errors.py::test_python_exception_matches
+		test/test_python_errors.py::test_default_except_error_postition
+	)
+	epytest ${deselect[@]/#/--deselect }
+}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/parso/, dev-python/parso/files/
@ 2021-08-05  7:29 Michał Górny
  0 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2021-08-05  7:29 UTC (permalink / raw
  To: gentoo-commits

commit:     bb5e0c79326b1e75f68e2fd75639c0f1cfae6bd5
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  5 07:13:58 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Aug  5 07:29:07 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bb5e0c79

dev-python/parso: Fix py3.10.0rc1 test failures

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/parso/files/parso-0.8.2-py310-2.patch | 57 ++++++++++++++++++++++++
 dev-python/parso/parso-0.8.2.ebuild              |  2 +-
 2 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/dev-python/parso/files/parso-0.8.2-py310-2.patch b/dev-python/parso/files/parso-0.8.2-py310-2.patch
new file mode 100644
index 00000000000..7c6b1ad7828
--- /dev/null
+++ b/dev-python/parso/files/parso-0.8.2-py310-2.patch
@@ -0,0 +1,57 @@
+From dc41958947770849c8b3b4d344db434e2c8548cc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Thu, 5 Aug 2021 09:09:28 +0200
+Subject: [PATCH] Update expected exception line numbers for Python 3.10.0rc1
+
+It seems that upstream has fixed line numbers in some of the expections
+in Python 3.10.0rc1, so update the tests accordingly.  This means that
+test_non_async_in_async() gets the correct line again,
+and test_default_except_error_postition() no longer suffers from
+the apparent off-by-one problem.
+
+This doesn't fix tests entirely with Python 3.10 but it's a step
+forward.
+---
+ test/test_python_errors.py | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/test/test_python_errors.py b/test/test_python_errors.py
+index cda9bd2..e847ebb 100644
+--- a/test/test_python_errors.py
++++ b/test/test_python_errors.py
+@@ -57,10 +57,10 @@ def test_non_async_in_async():
+         error, = errors
+         actual = error.message
+     assert actual in wanted
+-    if sys.version_info[:2] < (3, 8):
++    if sys.version_info[:2] not in ((3, 8), (3,9)):
+         assert line_nr == error.start_pos[0]
+     else:
+-        assert line_nr == 0  # For whatever reason this is zero in Python 3.8+
++        assert line_nr == 0  # For whatever reason this is zero in Python 3.8/3.9
+ 
+ 
+ @pytest.mark.parametrize(
+@@ -140,13 +140,16 @@ def _get_actual_exception(code):
+ 
+ 
+ def test_default_except_error_postition():
+-    # For this error the position seemed to be one line off, but that doesn't
+-    # really matter.
++    # For this error the position seemed to be one line off in Python < 3.10,
++    # but that doesn't really matter.
+     code = 'try: pass\nexcept: pass\nexcept X: pass'
+     wanted, line_nr = _get_actual_exception(code)
+     error, = _get_error_list(code)
+     assert error.message in wanted
+-    assert line_nr != error.start_pos[0]
++    if sys.version_info[:2] >= (3, 10):
++        assert line_nr == error.start_pos[0]
++    else:
++        assert line_nr != error.start_pos[0]
+     # I think this is the better position.
+     assert error.start_pos[0] == 2
+ 
+-- 
+2.32.0
+

diff --git a/dev-python/parso/parso-0.8.2.ebuild b/dev-python/parso/parso-0.8.2.ebuild
index 2637f5cf5c3..42be4262b42 100644
--- a/dev-python/parso/parso-0.8.2.ebuild
+++ b/dev-python/parso/parso-0.8.2.ebuild
@@ -20,6 +20,7 @@ distutils_enable_tests pytest
 
 PATCHES=(
 	"${FILESDIR}"/${P}-py310.patch
+	"${FILESDIR}"/${P}-py310-2.patch
 	"${FILESDIR}"/${P}-flaky-test.patch
 )
 
@@ -28,7 +29,6 @@ python_test() {
 	[[ ${EPYTHON} == python3.10 ]] && deselect+=(
 		# py3.10 changed exception messages
 		test/test_python_errors.py::test_python_exception_matches
-		test/test_python_errors.py::test_default_except_error_postition
 	)
 	epytest ${deselect[@]/#/--deselect }
 }


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/parso/, dev-python/parso/files/
@ 2021-08-05  7:29 Michał Górny
  0 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2021-08-05  7:29 UTC (permalink / raw
  To: gentoo-commits

commit:     43721251f27a53bd680dd43ed8e08745f7fa1d05
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  5 06:45:33 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Aug  5 07:29:06 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43721251

dev-python/parso: Backport flaky test fix

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../parso/files/parso-0.8.2-flaky-test.patch       | 23 ++++++++++++++++++++++
 dev-python/parso/parso-0.8.2.ebuild                |  1 +
 2 files changed, 24 insertions(+)

diff --git a/dev-python/parso/files/parso-0.8.2-flaky-test.patch b/dev-python/parso/files/parso-0.8.2-flaky-test.patch
new file mode 100644
index 00000000000..729ec409c82
--- /dev/null
+++ b/dev-python/parso/files/parso-0.8.2-flaky-test.patch
@@ -0,0 +1,23 @@
+From 60fed7b9f80cbb3d9cb7a9e42ad8c0f3c513801d Mon Sep 17 00:00:00 2001
+From: Saiyang Gou <gousaiyang@163.com>
+Date: Sat, 29 May 2021 18:17:24 -0700
+Subject: [PATCH] Fix flaky test_cache_last_used_update again (#189)
+
+This is a follow up for #177. On Windows, `assert node_cache_item.last_used < now` may fail as the two time values can be equal.
+---
+ 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 f4291c2..5e633fc 100644
+--- a/test/test_cache.py
++++ b/test/test_cache.py
+@@ -137,7 +137,7 @@ def test_cache_last_used_update(diff_cache, use_file_io):
+     parse('somecode', cache=True, path=p)
+     node_cache_item = next(iter(parser_cache.values()))[p]
+     now = time.time()
+-    assert node_cache_item.last_used < now
++    assert node_cache_item.last_used <= now
+ 
+     if use_file_io:
+         f = _FixedTimeFileIO(p, 'code', node_cache_item.last_used - 10)

diff --git a/dev-python/parso/parso-0.8.2.ebuild b/dev-python/parso/parso-0.8.2.ebuild
index 37196d2c7c2..2637f5cf5c3 100644
--- a/dev-python/parso/parso-0.8.2.ebuild
+++ b/dev-python/parso/parso-0.8.2.ebuild
@@ -20,6 +20,7 @@ distutils_enable_tests pytest
 
 PATCHES=(
 	"${FILESDIR}"/${P}-py310.patch
+	"${FILESDIR}"/${P}-flaky-test.patch
 )
 
 python_test() {


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/parso/, dev-python/parso/files/
@ 2021-08-24 23:21 Sam James
  0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2021-08-24 23:21 UTC (permalink / raw
  To: gentoo-commits

commit:     a4c1a28f9377831cb3a5d292afb6e0fd12465b64
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Tue Aug 24 16:05:36 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 24 23:20:46 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a4c1a28f

dev-python/parso: backport another test timing fix

Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../parso/files/parso-0.7.1-flaky-test.patch       | 37 ++++++++++++++++++++++
 dev-python/parso/parso-0.7.1-r1.ebuild             |  5 +++
 2 files changed, 42 insertions(+)

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 00000000000..609918f31bb
--- /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 d9d01c91294..74e95da16ba 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+=(


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-24 23:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-24 23:21 [gentoo-commits] repo/gentoo:master commit in: dev-python/parso/, dev-python/parso/files/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2021-08-05  7:29 Michał Górny
2021-08-05  7:29 Michał Górny
2021-06-30 12:21 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox