Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed in the test process in Python 3.13 #371

Open
medaminezghal opened this issue Dec 26, 2024 · 1 comment
Open

Failed in the test process in Python 3.13 #371

medaminezghal opened this issue Dec 26, 2024 · 1 comment

Comments

@medaminezghal
Copy link

medaminezghal commented Dec 26, 2024

================================================== FAILURES ==================================================
________________________________ DataclassesTest.test_tree_flatten_with_keys _________________________________

self = <chex._src.dataclass_test.DataclassesTest testMethod=test_tree_flatten_with_keys>

    def test_tree_flatten_with_keys(self):
      obj = dummy_dataclass()
      keys_and_leaves, treedef = jax.tree_util.tree_flatten_with_path(obj)
      self.assertEqual(
          [k for k, _ in keys_and_leaves],
          [
              (jax.tree_util.GetAttrKey('a'), jax.tree_util.GetAttrKey('c')),
              (jax.tree_util.GetAttrKey('a'), jax.tree_util.GetAttrKey('d')),
              (jax.tree_util.GetAttrKey('b'),),
          ],
      )
      leaves = [l for _, l in keys_and_leaves]
      new_obj = treedef.unflatten(leaves)
>     self.assertEqual(new_obj, obj)

chex/_src/dataclass_test.py:361: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
<string>:12: in __eq__
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = NestedDataclass(c=array([1., 1., 1.], dtype=float32), d=array([1., 1., 1., 1.], dtype=float32))
other = NestedDataclass(c=array([1., 1., 1.], dtype=float32), d=array([1., 1., 1., 1.], dtype=float32))

>   ???
E   ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

<string>:12: ValueError
_____________________________________ FailedTestsTest.test_useful_errors _____________________________________

self = <chex._src.variants_test.FailedTestsTest testMethod=test_useful_errors>

    def setUp(self):
      super().setUp()
      self.chex_info = str(variants.ChexVariantType.WITHOUT_JIT)
      self.res = unittest.TestResult()
>     ts = unittest.makeSuite(self.FailedTest)  # pytype: disable=module-attr
E     AttributeError: module 'unittest' has no attribute 'makeSuite'

chex/_src/variants_test.py:259: AttributeError
____________________________________ FailedTestsTest.test_useful_failures ____________________________________

self = <chex._src.variants_test.FailedTestsTest testMethod=test_useful_failures>

    def setUp(self):
      super().setUp()
      self.chex_info = str(variants.ChexVariantType.WITHOUT_JIT)
      self.res = unittest.TestResult()
>     ts = unittest.makeSuite(self.FailedTest)  # pytype: disable=module-attr
E     AttributeError: module 'unittest' has no attribute 'makeSuite'

chex/_src/variants_test.py:259: AttributeError
__________________________________ OneFailedVariantTest.test_useful_failure __________________________________

self = <chex._src.variants_test.OneFailedVariantTest testMethod=test_useful_failure>

    def test_useful_failure(self):
      expected_info = str(variants.ChexVariantType.WITHOUT_DEVICE)
      unexpected_info = str(variants.ChexVariantType.WITH_DEVICE)
    
      res = unittest.TestResult()
>     ts = unittest.makeSuite(self.MaybeFailedTest)  # pytype: disable=module-attr
E     AttributeError: module 'unittest' has no attribute 'makeSuite'

chex/_src/variants_test.py:294: AttributeError
__________________________________ WrongBaseClassTest.test_wrong_base_class __________________________________

self = <chex._src.variants_test.WrongBaseClassTest testMethod=test_wrong_base_class>

    def test_wrong_base_class(self):
      res = unittest.TestResult()
>     ts = unittest.makeSuite(self.InnerTest)  # pytype: disable=module-attr
E     AttributeError: module 'unittest' has no attribute 'makeSuite'

chex/_src/variants_test.py:314: AttributeError
_______________________________ BaseClassesTest.test_inheritance_parameterized _______________________________

self = <chex._src.variants_test.BaseClassesTest testMethod=test_inheritance_parameterized>
base_classes = (<class 'absl.testing.parameterized.TestCase'>, <class 'object'>)

    @parameterized.named_parameters(
        ('parameterized', (parameterized.TestCase, object)),
        ('variants', (variants.TestCase, object)),
        ('variants_and_parameterized',
         (variants.TestCase, parameterized.TestCase)),
    )
    def test_inheritance(self, base_classes):
      res = unittest.TestResult()
      test_class = self.generate_test_class(*base_classes)
      for base_class in base_classes:
        self.assertTrue(issubclass(test_class, base_class))
>     ts = unittest.makeSuite(test_class)  # pytype: disable=module-attr
E     AttributeError: module 'unittest' has no attribute 'makeSuite'

chex/_src/variants_test.py:350: AttributeError
_________________________________ BaseClassesTest.test_inheritance_variants __________________________________

self = <chex._src.variants_test.BaseClassesTest testMethod=test_inheritance_variants>
base_classes = (<class 'chex._src.variants.TestCase'>, <class 'object'>)

    @parameterized.named_parameters(
        ('parameterized', (parameterized.TestCase, object)),
        ('variants', (variants.TestCase, object)),
        ('variants_and_parameterized',
         (variants.TestCase, parameterized.TestCase)),
    )
    def test_inheritance(self, base_classes):
      res = unittest.TestResult()
      test_class = self.generate_test_class(*base_classes)
      for base_class in base_classes:
        self.assertTrue(issubclass(test_class, base_class))
>     ts = unittest.makeSuite(test_class)  # pytype: disable=module-attr
E     AttributeError: module 'unittest' has no attribute 'makeSuite'

chex/_src/variants_test.py:350: AttributeError
________________________ BaseClassesTest.test_inheritance_variants_and_parameterized _________________________

self = <chex._src.variants_test.BaseClassesTest testMethod=test_inheritance_variants_and_parameterized>
base_classes = (<class 'chex._src.variants.TestCase'>, <class 'absl.testing.parameterized.TestCase'>)

    @parameterized.named_parameters(
        ('parameterized', (parameterized.TestCase, object)),
        ('variants', (variants.TestCase, object)),
        ('variants_and_parameterized',
         (variants.TestCase, parameterized.TestCase)),
    )
    def test_inheritance(self, base_classes):
      res = unittest.TestResult()
      test_class = self.generate_test_class(*base_classes)
      for base_class in base_classes:
        self.assertTrue(issubclass(test_class, base_class))
>     ts = unittest.makeSuite(test_class)  # pytype: disable=module-attr
E     AttributeError: module 'unittest' has no attribute 'makeSuite'

chex/_src/variants_test.py:350: AttributeError
___________________________ VariantsTestCaseWithParameterizedTest.test_should_pass ___________________________

self = <chex._src.variants_test.VariantsTestCaseWithParameterizedTest testMethod=test_should_pass>

    def test_should_pass(self):
      res = unittest.TestResult()
>     ts = unittest.makeSuite(self.InnerTest)  # pytype: disable=module-attr
E     AttributeError: module 'unittest' has no attribute 'makeSuite'

chex/_src/variants_test.py:369: AttributeError
___________________________________ UnusedVariantTest.test_unused_variant ____________________________________

self = <chex._src.variants_test.UnusedVariantTest testMethod=test_unused_variant>

    def test_unused_variant(self):
      res = unittest.TestResult()
>     ts = unittest.makeSuite(self.InnerTest)  # pytype: disable=module-attr
E     AttributeError: module 'unittest' has no attribute 'makeSuite'

chex/_src/variants_test.py:426: AttributeError
_____________________________ UnknownVariantArgumentsTest.test_unknown_argument ______________________________

self = <chex._src.variants_test.UnknownVariantArgumentsTest testMethod=test_unknown_argument>

    def test_unknown_argument(self):
      res = unittest.TestResult()
>     ts = unittest.makeSuite(self.InnerTest)  # pytype: disable=module-attr
E     AttributeError: module 'unittest' has no attribute 'makeSuite'

chex/_src/variants_test.py:459: AttributeError
____________________________________ VariantTypesTest.test_var_type_fetch ____________________________________

self = <chex._src.variants_test.VariantTypesTest testMethod=test_var_type_fetch>

    def test_var_type_fetch(self):
>     ts = unittest.makeSuite(self.InnerTest)  # pytype: disable=module-attr
E     AttributeError: module 'unittest' has no attribute 'makeSuite'

chex/_src/variants_test.py:478: AttributeError
______________________________________ CountVariantsTest.test_counters _______________________________________

self = <chex._src.variants_test.CountVariantsTest testMethod=test_counters>

    def test_counters(self):
      res = unittest.TestResult()
>     ts = unittest.makeSuite(self.InnerTest)  # pytype: disable=module-attr
E     AttributeError: module 'unittest' has no attribute 'makeSuite'

chex/_src/variants_test.py:524: AttributeError
========================================== short test summary info ===========================================
FAILED chex/_src/dataclass_test.py::DataclassesTest::test_tree_flatten_with_keys - ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
FAILED chex/_src/variants_test.py::FailedTestsTest::test_useful_errors - AttributeError: module 'unittest' has no attribute 'makeSuite'
FAILED chex/_src/variants_test.py::FailedTestsTest::test_useful_failures - AttributeError: module 'unittest' has no attribute 'makeSuite'
FAILED chex/_src/variants_test.py::OneFailedVariantTest::test_useful_failure - AttributeError: module 'unittest' has no attribute 'makeSuite'
FAILED chex/_src/variants_test.py::WrongBaseClassTest::test_wrong_base_class - AttributeError: module 'unittest' has no attribute 'makeSuite'
FAILED chex/_src/variants_test.py::BaseClassesTest::test_inheritance_parameterized - AttributeError: module 'unittest' has no attribute 'makeSuite'
FAILED chex/_src/variants_test.py::BaseClassesTest::test_inheritance_variants - AttributeError: module 'unittest' has no attribute 'makeSuite'
FAILED chex/_src/variants_test.py::BaseClassesTest::test_inheritance_variants_and_parameterized - AttributeError: module 'unittest' has no attribute 'makeSuite'
FAILED chex/_src/variants_test.py::VariantsTestCaseWithParameterizedTest::test_should_pass - AttributeError: module 'unittest' has no attribute 'makeSuite'
FAILED chex/_src/variants_test.py::UnusedVariantTest::test_unused_variant - AttributeError: module 'unittest' has no attribute 'makeSuite'
FAILED chex/_src/variants_test.py::UnknownVariantArgumentsTest::test_unknown_argument - AttributeError: module 'unittest' has no attribute 'makeSuite'
FAILED chex/_src/variants_test.py::VariantTypesTest::test_var_type_fetch - AttributeError: module 'unittest' has no attribute 'makeSuite'
FAILED chex/_src/variants_test.py::CountVariantsTest::test_counters - AttributeError: module 'unittest' has no attribute 'makeSuite'
================================ 13 failed, 554 passed, 85 skipped in 59.27s =================================

As I searched the makeSuite function is deprecated and removed from python 3.13 and the eq has changed so it's not compatible with python 3.13

@daskol
Copy link

daskol commented Dec 27, 2024

It seems that there are two different issues related to new Python 3.13 release. The first one is deprecation of some unittest routes (see python/cpython#104836). The second one is related to assertEqual assertion and it seems to be a bug in dataclasses (see python/cpython#128294). The former is easy to fix but the latter seems serious issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants