File: 0028-libtbx-update-test-for-Python-3.11.patch

package info (click to toggle)
cctbx 2022.9%2Bds2%2B~3.11.2%2Bds1-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 130,052 kB
  • sloc: python: 815,067; cpp: 289,996; ansic: 22,472; fortran: 18,268; javascript: 1,852; sh: 1,145; sql: 632; csh: 519; java: 368; makefile: 316; xml: 25
file content (32 lines) | stat: -rw-r--r-- 1,187 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From: "Billy K. Poon" <bkpoon@lbl.gov>
Date: Thu, 10 Nov 2022 13:43:40 -0800
Subject: libtbx: update test for Python 3.11

Origin: upstream, https://github.com/cctbx/cctbx_project/commit/c1abc42da889e57665a40b81ad4f76778970a200
---
 libtbx/find_reference_cycles.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libtbx/find_reference_cycles.py b/libtbx/find_reference_cycles.py
index 0579743..9d71a49 100644
--- a/libtbx/find_reference_cycles.py
+++ b/libtbx/find_reference_cycles.py
@@ -91,11 +91,16 @@ def exercise():
   # "   <class '__main__.bad_class'> -- <__main__.bad_class object at 0xb7eb5d2c> ->"
   # "   <type 'dict'> --  ->"
   # ''
-  assert len(lines) == 4
+  # For Python 3.11, the <type 'dict'> line is missing
+  if sys.version_info.major == 3 and sys.version_info.minor >= 11:
+    assert len(lines) == 3
+  else:
+    assert len(lines) == 4
   assert lines[0].startswith("Examining: <")
   assert lines[0].count("bad_class") == 1
   assert lines[1].count("bad_class") == 2
-  assert lines[2].count("dict") == 1
+  if sys.version_info.major == 3 and sys.version_info.minor < 11:
+    assert lines[2].count("dict") == 1
 
   print("OK")