Uploaded image for project: 'Qpid Dispatch'
  1. Qpid Dispatch
  2. DISPATCH-2186

Pytest runner reports test collection warnings which proved to be misleading to the unwarry

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.16.0
    • 1.17.0
    • Tests
    • None

    Description

      The affected classes are

      • TestTimeout

      The issue was discussed between me (jdanek) and fgiorget on the original DISPATCH-1933 where we decided it should be eventually fixed, somehow.

       39: =============================== warnings summary ===============================
      39: ../../tests/system_test.py:1259
      39:   /home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/tests/system_test.py:1259: PytestCollectionWarning: cannot collect test class 'TestTimeout' because it has a __init__ constructor (from: )
      39:     class TestTimeout(object):
      39: 
      39: -- Docs: https://docs.pytest.org/en/stable/warnings.html
      39: - generated xml file: /home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/build/tests/junitxmls/system_tests_multi_tenancy_policy.xml -
      39: ======================== 36 passed, 1 warning in 14.84s ========================
      22/38 Test #39: system_tests_multi_tenancy_policy .......   Passed   15.09 sec
      

      The problem is that Pytest's test discovery looks for test classes by name (in addition to lookup by superclass, the way Python unittest lib works). When Pytest finds a class that matches name pattern, it will try to collect it, but that will fail in cases the class is a test helper which has an _init_ method.

      One solution would be to rename the affected classes. Or modify Pytests test discovery logic (it is configurable) or to suppress the warning.

      Attachments

        Activity

          People

            jdanek Jiri Daněk
            jdanek Jiri Daněk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: