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

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.16.0
    • Fix Version/s: 1.17.0
    • Component/s: Tests
    • Labels:
      None

      Description

      The affected classes are

      • TestTimeout

      The issue was discussed between me (Jiri Daněk) and Fernando Giorgetti 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

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

              Dates

              • Created:
                Updated:
                Resolved: