diff --git a/libtbx/clusterTests.py b/libtbx/clusterTests.py index 1274230c6b..7637878dd9 100644 --- a/libtbx/clusterTests.py +++ b/libtbx/clusterTests.py @@ -187,11 +187,11 @@ def testLostFunctionReference(self): if (__name__ == "__main__"): unittest.TextTestRunner(stream=sys.stdout, verbosity=0).run( unittest.TestSuite(( - unittest.makeSuite(HClusterSmallListTestCase), - unittest.makeSuite(HClusterIntegerTestCase), - unittest.makeSuite(HClusterStringTestCase), - unittest.makeSuite(KClusterSmallListTestCase), - unittest.makeSuite(KCluster2DTestCase), - unittest.makeSuite(KClusterSFBugs), + unittest.defaultTestLoader.loadTestsFromTestCase(HClusterSmallListTestCase), + unittest.defaultTestLoader.loadTestsFromTestCase(HClusterIntegerTestCase), + unittest.defaultTestLoader.loadTestsFromTestCase(HClusterStringTestCase), + unittest.defaultTestLoader.loadTestsFromTestCase(KClusterSmallListTestCase), + unittest.defaultTestLoader.loadTestsFromTestCase(KCluster2DTestCase), + unittest.defaultTestLoader.loadTestsFromTestCase(KClusterSFBugs), )) ) diff --git a/libtbx/object_oriented_patterns.py b/libtbx/object_oriented_patterns.py index 9c331b9095..0a7b8c5c39 100644 --- a/libtbx/object_oriented_patterns.py +++ b/libtbx/object_oriented_patterns.py @@ -19,6 +19,9 @@ def __init__(cls, name, bases, namespace, **kwds): if sys.hexversion >= 0x03000000: if name in ('__qualname__',): continue + if sys.version_info.major == 3 and sys.version_info.minor >= 13: + if name in ('__firstlineno__', '__static_attributes__'): + continue assert not hasattr(target_class, name), ( "class %s already has attribute '%s'" % (target_class.__name__, name)) diff --git a/libtbx/tst_object_oriented_patterns.py b/libtbx/tst_object_oriented_patterns.py index 6f27522468..a6e0cee57d 100644 --- a/libtbx/tst_object_oriented_patterns.py +++ b/libtbx/tst_object_oriented_patterns.py @@ -65,7 +65,9 @@ def f(x): pass else: raise Exception_expected - assert mf.__doc__ == """ Documentation for function f """ + # Python 3.13 automatically strips leading spaces + assert mf.__doc__ == """ Documentation for function f """ \ + or mf.__doc__ == """Documentation for function f """ def exercise_memoize_with_injector(): class foo(object): @@ -97,7 +99,8 @@ def f(self, x): assert diagnostic == ['+']*4 assert o1.f(1) == 2 assert diagnostic == ['+']*4 - assert o1.f.__doc__ == " Documentation for method f " + assert o1.f.__doc__ == " Documentation for method f " \ + or o1.f.__doc__ == "Documentation for method f " class _foo_extension(oop.injector, foo): def g(self, n):