Bug 2208494 - androguard fails to build with Python 3.12: AttributeError: 'AnalysisTest' object has no attribute 'assertEquals'.
Summary: androguard fails to build with Python 3.12: AttributeError: 'AnalysisTest' ob...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: androguard
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Fabian Affolter
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2219930 (view as bug list)
Depends On:
Blocks: PYTHON3.12 F39FTBFS F39FailsToInstall F40FailsToInstall F40FTBFS
TreeView+ depends on / blocked
 
Reported: 2023-05-19 09:21 UTC by Tomáš Hrnčiar
Modified: 2023-12-14 04:25 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-08-15 07:55:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2023-05-19 09:21:00 UTC
androguard fails to build with Python 3.12.0a7.

=================================== FAILURES ===================================
___________________________ AnalysisTest.testExtends ___________________________

self = <test_analysis.AnalysisTest testMethod=testExtends>

    def testExtends(self):
        h, d, dx = AnalyzeDex('examples/tests/ExceptionHandling.dex')
    
        cls = dx.classes['LSomeException;']
>       self.assertEquals(cls.extends, 'Ljava/lang/Exception;')
E       AttributeError: 'AnalysisTest' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

tests/test_analysis.py:120: AttributeError
_________________________ AnalysisTest.testInterfaces __________________________

self = <test_analysis.AnalysisTest testMethod=testInterfaces>

    def testInterfaces(self):
        h, d, dx = AnalyzeDex('examples/tests/InterfaceCls.dex')
    
        cls = dx.classes['LInterfaceCls;']
        self.assertIn('Ljavax/net/ssl/X509TrustManager;', cls.implements)
>       self.assertEquals(cls.name, 'LInterfaceCls;')
E       AttributeError: 'AnalysisTest' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

tests/test_analysis.py:114: AttributeError
_________________________ SessionTest.testSessionLoad __________________________

self = <test_session.SessionTest testMethod=testSessionLoad>

    def testSessionLoad(self):
        s = session.Session()
        with open("examples/android/TestsAndroguard/bin/TestActivity.apk",
                  "rb") as fd:
            s.add("examples/android/TestsAndroguard/bin/TestActivity.apk",
                  fd.read())
            session.Save(s, "test_session")
    
        self.assertIn('2f24538b3064f1f88d3eb29ee7fbd2146779a4c9144aefa766d18965be8775c7', s.analyzed_dex.keys())
        self.assertIn('3bb32dd50129690bce850124ea120aa334e708eaa7987cf2329fd1ea0467a0eb', s.analyzed_apk.keys())
        x = s.analyzed_apk['3bb32dd50129690bce850124ea120aa334e708eaa7987cf2329fd1ea0467a0eb'][0]
        self.assertIsInstance(x, APK)
    
>       nsession = session.Load("test_session")

tests/test_session.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

filename = 'test_session'

    def Load(filename):
        """
          load your session!
    
          example::
    
              s = session.Load("mysession.ag")
    
          :param filename: the filename where the session has been saved
          :type filename: string
    
          :rtype: the elements of your session :)
    
        """
>       with open(filename, "rb") as fd:
E       FileNotFoundError: [Errno 2] No such file or directory: 'test_session'

../../BUILDROOT/androguard-3.3.5-12.fc39.x86_64/usr/lib/python3.12/site-packages/androguard/session.py:86: FileNotFoundError
------------------------------ Captured log call -------------------------------
ERROR    androguard.session:session.py:62 Recursion Limit hit while saving. Current Recursion limit: 50000. Please report this error!
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/androguard-3.3.5-12.fc39.x86_64/usr/lib/python3.12/site-packages/androguard/session.py", line 59, in Save
    pickle.dump(session, fd)
RecursionError: maximum recursion depth exceeded while pickling an object
=============================== warnings summary ===============================
tests/test_analysis.py:34
  /builddir/build/BUILD/androguard-3.3.5/tests/test_analysis.py:34: SyntaxWarning: invalid escape sequence '\('
    self.assertEqual(len(list(dx.find_methods(classname="^(?!Landroid).*;$", methodname="<init>", descriptor="^\(.+\).*$"))), 138)

tests/test_analysis.py:35
  /builddir/build/BUILD/androguard-3.3.5/tests/test_analysis.py:35: SyntaxWarning: invalid escape sequence '\('
    self.assertEqual(len(list(dx.find_methods(classname="^(?!Landroid).*;$", methodname="<init>", descriptor="^\(.+\).*$", no_external=True))), 94)

tests/test_analysis.py:38
  /builddir/build/BUILD/androguard-3.3.5/tests/test_analysis.py:38: SyntaxWarning: invalid escape sequence '\/'
    self.assertEqual(len(list(dx.find_strings(".*:\/\/.*"))), 15)

tests/test_analysis.py:41
  /builddir/build/BUILD/androguard-3.3.5/tests/test_analysis.py:41: SyntaxWarning: invalid escape sequence '\/'
    self.assertEqual(len(list(dx.find_fields(classname="^(?!Landroid).*;$", fieldtype="Ljava\/lang\/String;"))), 63)

tests/test_decompiler.py:46
  tests/test_decompiler.py:46: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_all_decompiler will be ignored
    def test_all_decompiler():

../../../../usr/lib/python3.12/site-packages/pkg_resources/__init__.py:121
  /usr/lib/python3.12/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
    warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)

../../../../usr/lib/python3.12/site-packages/pkg_resources/__init__.py:2870
../../../../usr/lib/python3.12/site-packages/pkg_resources/__init__.py:2870
../../../../usr/lib/python3.12/site-packages/pkg_resources/__init__.py:2870
../../../../usr/lib/python3.12/site-packages/pkg_resources/__init__.py:2870
../../../../usr/lib/python3.12/site-packages/pkg_resources/__init__.py:2870
../../../../usr/lib/python3.12/site-packages/pkg_resources/__init__.py:2870
../../../../usr/lib/python3.12/site-packages/pkg_resources/__init__.py:2870
  /usr/lib/python3.12/site-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

tests/test_analysis.py: 3 warnings
tests/test_decompiler.py: 2 warnings
tests/test_dex.py: 1 warning
tests/test_rename.py: 1 warning
tests/test_session.py: 8 warnings
  /builddir/build/BUILDROOT/androguard-3.3.5-12.fc39.x86_64/usr/lib/python3.12/site-packages/androguard/core/bytecodes/dvm.py:7709: DeprecationWarning: deprecated, this method does nothing!
    warnings.warn("deprecated, this method does nothing!", DeprecationWarning)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_analysis.py::AnalysisTest::testExtends - AttributeError: 'A...
FAILED tests/test_analysis.py::AnalysisTest::testInterfaces - AttributeError:...
FAILED tests/test_session.py::SessionTest::testSessionLoad - FileNotFoundErro...

    - 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/05934801-androguard/

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

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 Tomáš Hrnčiar 2023-07-11 13:25:19 UTC
*** Bug 2219930 has been marked as a duplicate of this bug. ***

Comment 2 Fedora Fails To Install 2023-07-19 04:52:44 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/

This package fails to install and maintainers are advised to take one of the following actions:

 - Fix this bug and close this bugzilla once the update makes it to the repository.
   (The same script that posted this comment will eventually close this bugzilla
   when the fixed package reaches the repository, so you don't have to worry about it.)

or

 - Move this bug to ASSIGNED if you plan on fixing this, but simply haven't done so yet.

or

 - Orphan the package if you no longer plan to maintain it.


If you do not take one of these actions, the process at https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/#_package_removal_for_long_standing_ftbfs_and_fti_bugs will continue.
This package may be orphaned in 7+ weeks.
This is the first reminder (step 3) from the policy.

Don't hesitate to ask for help on devel.org if you are unsure how to fix this bug.

Comment 3 Fedora Fails To Install 2023-08-13 12:17:33 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/

This package fails to install and maintainers are advised to take one of the following actions:

 - Fix this bug and close this bugzilla once the update makes it to the repository.
   (The same script that posted this comment will eventually close this bugzilla
   when the fixed package reaches the repository, so you don't have to worry about it.)

or

 - Move this bug to ASSIGNED if you plan on fixing this, but simply haven't done so yet.

or

 - Orphan the package if you no longer plan to maintain it.


If you do not take one of these actions, the process at https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/#_package_removal_for_long_standing_ftbfs_and_fti_bugs will continue.
This package may be orphaned in 4+ weeks.
This is the second reminder (step 4) from the policy.

Don't hesitate to ask for help on https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ if you are unsure how to fix this bug.

Comment 4 Miro Hrončok 2023-08-15 07:55:38 UTC
Automation has figured out the package is retired in rawhide.

If you like it to be unretired, please open a ticket at https://pagure.io/releng/new_issue?template=package_unretirement

Comment 5 Red Hat Bugzilla 2023-12-14 04:25:09 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days


Note You need to log in before you can comment on or make changes to this bug.