Blob Blame History Raw
From 9723fc90f0b1f8f48c1109d501a31309f93add92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 9 Jun 2021 10:50:06 +0200
Subject: [PATCH 2/2] tests: adjust for different line numbers under python3.10

I think this is related to
https://docs.python.org/3.10/whatsnew/3.10.html#pep-626-precise-line-numbers-for-debugging-and-other-tools

For https://bugzilla.redhat.com/show_bug.cgi?id=1908278.
The tests now pass with python3-3.9.5-2.fc34.x86_64 and
python3-3.10.0~b2-3.fc35.x86_64.
---
 tests/test_codeblock.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/test_codeblock.py b/tests/test_codeblock.py
index c9f8b1784d..c30ae3a3ae 100644
--- a/tests/test_codeblock.py
+++ b/tests/test_codeblock.py
@@ -44,7 +44,7 @@ def test_future_imports():
     )
     # the future import line drops the firstlineno by 1
     code = compile_codeblock(regions[0].parsed, document.path)
-    assert code.co_firstlineno == 2
+    assert code.co_firstlineno in (1, 2)  # we get 1 under python3.10
     assert evaluate_region(regions[1], namespace) is None
     assert buffer.getvalue() == (
         'pathalogical worst case for line numbers\n'
@@ -52,7 +52,7 @@ def test_future_imports():
     )
     # the future import line drops the firstlineno by 1
     code = compile_codeblock(regions[1].parsed, document.path)
-    assert code.co_firstlineno == 8
+    assert code.co_firstlineno in (1, 8)  # we get 1 under python3.10
 
 
 def test_windows_line_endings(tmp_path):
-- 
2.32.0.rc3