Bug 2155241

Summary: python-jep fails to build with Python 3.12: AttributeError: 'TestNumpy' object has no attribute 'assertEquals'.
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-jepAssignee: Orphan Owner <extras-orphan>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 39CC: fti-bugs, mhroncok, python-packagers-sig, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-27 08:46:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2168845, 2135404    

Description Tomáš Hrnčiar 2022-12-20 13:50:31 UTC
python-jep fails to build with Python 3.12.0a3.

======================================================================
ERROR: test_deepList (test_call.TestTypes.test_deepList)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_call.py", line 76, in test_deepList
    self.assertEquals(self.test, result[0])
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestTypes' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: test_observer (test_call.TestTypes.test_observer)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_call.py", line 118, in test_observer
    self.assertEquals(len(a), 1)
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestTypes' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: test_inner_class (test_import.TestImport.test_inner_class)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_import.py", line 47, in test_inner_class
    self.assertEquals(Thread.currentThread().getState(), Thread.State.RUNNABLE)
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestImport' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: testDirect (test_numpy.TestNumpy.testDirect)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_numpy.py", line 173, in testDirect
    self.assertIntDirect(buffer)
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_numpy.py", line 154, in assertIntDirect
    self.assertEquals(1, buffer.get(0))
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestNumpy' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: testDirectArgReturn (test_numpy.TestNumpy.testDirectArgReturn)
Tests making a python ndarray from a java DirectNDArray.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_numpy.py", line 138, in testDirectArgReturn
    self.assertEquals(1, ndarray2[0])
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestNumpy' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: testDirectNative (test_numpy.TestNumpy.testDirectNative)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_numpy.py", line 186, in testDirectNative
    self.assertIntDirect(buffer)
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_numpy.py", line 154, in assertIntDirect
    self.assertEquals(1, buffer.get(0))
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestNumpy' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: testPassingDirect (test_numpy.TestNumpy.testPassingDirect)
Test that when a numpy ndarray created from a java direct buffer is
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_numpy.py", line 210, in testPassingDirect
    self.assertEquals(1, ndarray2[0])
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestNumpy' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: testScalarBoxing (test_numpy.TestNumpy.testScalarBoxing)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_numpy.py", line 220, in testScalarBoxing
    self.assertEquals('java.lang.Float', getClass(numpy.float32(1.5)).java_name)
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestNumpy' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: test_java_name (test_object.TestObject.test_java_name)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_object.py", line 21, in test_java_name
    self.assertEquals(Object.java_name, "java.lang.Object")
    ^^^^^^^^^^^^^^^^^
AttributeError: 'TestObject' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

Removed many old deprecated unittest features:

    - A number of TestCase method aliases:

    | Deprecated alias      |  Method Name           | Deprecated in |
    +-----------------------|------------------------|---------------+
    | failUnless            | assertTrue()           |      3.1      |
    | failIf                | assertFalse()          |      3.1      |
    | failUnlessEqual       | assertEqual()          |      3.1      |
    | failIfEqual           | assertNotEqual()       |      3.1      |
    | failUnlessAlmostEqual | assertAlmostEqual()    |      3.1      |
    | failIfAlmostEqual     | assertNotAlmostEqual() |      3.1      |
    | failUnlessRaises      | assertRaises()         |      3.1      |
    | assert_               | assertTrue()           |      3.2      |
    | assertEquals          | assertEqual()          |      3.2      |
    | assertNotEquals       | assertNotEqual()       |      3.2      |
    | assertAlmostEquals    | assertAlmostEqual()    |      3.2      |
    | assertNotAlmostEquals | assertNotAlmostEqual() |      3.2      |
    | assertRegexpMatches   | assertRegex()          |      3.2      |
    | assertRaisesRegexp    | assertRaisesRegex()    |      3.2      |
    | assertNotRegexpMatches| assertNotRegex()       |      3.5      |
    +-----------------------|------------------------|---------------+

    You can use https://github.com/isidentical/teyit to automatically modernise your unit tests.

    - Undocumented and broken TestCase method assertDictContainsSubset (deprecated in Python 3.2).

    - Undocumented TestLoader.loadTestsFromModule parameter use_load_tests (deprecated and ignored since Python 3.2).

    - An alias of the TextTestResult class: _TextTestResult (deprecated in Python
3.2).

(Contributed by Serhiy Storchaka in bpo-45162.)
https://bugs.python.org/issue?@action=redirect&bpo=45162



https://docs.python.org/3.12/whatsnew/3.12.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.12/fedora-rawhide-x86_64/05129002-python-jep/

For all our attempts to build python-jep with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/python-jep/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.12:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Raphael Groner 2022-12-29 11:10:55 UTC
Thanks for letting me know about Python 3.12 and further plannings in Fedora.

There's new upstream relase. Can you reproduce noticed test failure with recent version 4.1.1? See rhbz#2003425.

Comment 2 Miro Hrončok 2022-12-29 17:48:38 UTC
> Can you reproduce noticed test failure with recent version 4.1.1?

I am sorry, but there are hundreds of packages failing to build with Python 3.12, we don't have the capacity to update all of them to see if it helps. If you open a PR to https://src.fedoraproject.org/rpms/python-jep we can quickly tell whether it helps or not in https://copr.fedorainfracloud.org/coprs/g/python/python3.12/builds/?dirname=python3.12:pr:<pr_number>

Comment 3 Raphael Groner 2023-01-08 16:27:18 UTC
Thanks for your report. Unfortunately, provided backtrace and retrace isn't helpful. 
Crash seems to happen while event processing (what happened?) somewhere down in libc memory management.

Comment 4 Raphael Groner 2023-01-08 16:28:00 UTC
(In reply to Raphael Groner from comment #3)
...

please ignore, sorry.

Comment 5 Ben Cotton 2023-02-07 15:03:29 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 6 Raphael Groner 2023-07-24 19:09:58 UTC
Python 3.12 is planned to be included in Fedora 39.

(In reply to Ben Cotton from comment #5)
> This bug appears to have been reported against 'rawhide' during the Fedora
> Linux 38 development cycle.
> Changing version to 38.

Comment 7 Raphael Groner 2023-07-29 10:35:52 UTC
*** Bug 2220289 has been marked as a duplicate of this bug. ***

Comment 8 Raphael Groner 2023-07-30 07:59:45 UTC
Deprecation with NumPy 1.20 filed to upstream.

ERROR: testArrayParams (test_numpy.TestNumpy.testArrayParams)
Tests passing an ndarray to a Java method that is expecting
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_numpy.py", line 73, in testArrayParams
    za = numpy.zeros((15, 5), numpy.bool)
                              ^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Comment 9 Raphael Groner 2023-07-30 12:52:12 UTC
After added path for deprecation of numpy.bool there's issue with java classpath while %check starts but in rawhide only, F38 and F37 builds and tests work fine.

+ java -cp 'build/java/*' jep.Run src/test/python/runtests.py
jep.JepException: <class 'ModuleNotFoundError'>: No module named 'java'
        at src/test/python/runtests.<module>(runtests.py:2)
        at jep.Jep.run(Native Method)
        at jep.Jep.runScript(Jep.java:384)
        at jep.Jep.runScript(Jep.java:355)
        at jep.Run.run(Run.java:64)
        at jep.Run.main(Run.java:146)

Comment 10 Raphael Groner 2023-07-31 05:14:36 UTC
(In reply to Raphael Groner from comment #8)
> Deprecation with NumPy 1.20 filed to upstream.

Fixed.
https://github.com/ninia/jep/commit/c6981203ee1acddd9df8b25d98ea9ec340e84106

Comment 11 Fedora Release Engineering 2023-08-16 07:06:23 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.

Comment 12 Raphael Groner 2023-09-10 15:06:50 UTC
Orphaned due to lack of time.

Comment 13 Fedora Fails To Install 2023-09-12 10:37:27 UTC
This package has been orphaned.

You can pick it up at https://src.fedoraproject.org/rpms/python-jep by clicking button "Take". If nobody picks it up, it will be retired and removed from a distribution.

Comment 14 Miro Hrončok 2023-09-26 09:49:15 UTC
Considering the final freeze is in a week, I decided to retire this package.

If fixed, it can be reintroduced later in the Fedora 39 life cycle.

Comment 15 Fedora Fails To Install 2023-09-27 08:45:34 UTC
Hello,

Please note that this comment was generated automatically by https://pagure.io/releng/blob/main/f/scripts/ftbfs-fti/follow-policy.py
If you feel that this output has mistakes, please open an issue at https://pagure.io/releng/

All subpackages of a package against which this bug was filled are now installable or removed from Fedora 40.

Thanks for taking care of it!

Comment 16 Fedora Fails To Install 2023-09-27 08:46:35 UTC
Hello,

Please note that this comment was generated automatically by https://pagure.io/releng/blob/main/f/scripts/ftbfs-fti/follow-policy.py
If you feel that this output has mistakes, please open an issue at https://pagure.io/releng/

All subpackages of a package against which this bug was filled are now installable or removed from Fedora 39.

Thanks for taking care of it!