Skip to content

GitHub tests are failing on Python 3.12 alpha 7 #569

Closed

Description

@cclauss

Activity

  1. giampaolo commented on Apr 20, 2023

    @giampaolo
    (__main__.Test.test) ... /opt/hostedtoolcache/Python/3.12.0-alpha.7/x64/lib/python3.12/unittest/case.py:580: RuntimeWarning: TestResult has no addDuration method\n  warnings.warn("TestResult has no addDuration method",\nok\n\n----------------------------------------------------------------------\nRan 1 test in 0.001s\n\nOK\n'
    

    Seems related to: python/cpython#12271.

    Without getting into deep analysys: the test seems to fail because unittest.TestCase class in python 3.12 has a new addDuration method. I imagine nose subclasses unittest.TestCase and extends it in some way. Python 3.12's unittest module is complaining (warning) that your custom sublcass does not provide an addDuration method. Defining an addDuration method will remove the warning and fix the failure.

  2. cclauss commented on Apr 20, 2023

    @cclauss
    ContributorAuthor

    https://github.com/python/cpython/pull/12271/files#diff-14c3c1d897d1e85767303f24626acaa6d1ea1162219c72caa240ef9f533ebe99R2176-R2181

       .. method:: addDuration(test, elapsed)
    
          Called when the test case finishes.  *elapsed* is the time represented in
          seconds, and it includes the execution of cleanup functions.
    
          .. versionadded:: 3.12
    
  3. sirosen commented on Apr 25, 2023

    @sirosen
    Collaborator

    My thanks to both of you for running this down and providing the breadcrumbs for me to understand what was happening. I've just merged @cclauss's fix and will make sure to cite him in the changelog under py3.12 compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions