Skip to content

-q no longer impacts --collect-only (when used with --log-cli-level) #5383

@adamtheturtle

Description

@adamtheturtle

I have an application which parses pytest test collection output.

Until pytest 4.3.1 I could get easily parseable output with --collect-only -q.

~> pytest --collect-only -q tests/test_dcos_e2e/backends/docker/test_distributions.py::TestCoreOS::test_oss
tests/test_dcos_e2e/backends/docker/test_distributions.py::TestCoreOS::test_oss

no tests ran in 0.02 seconds

From @RonnyPfannschmidt here we see:

thats supported with -q for just test ids and -qq for just test filenames

However, with pytest>=4.4.0 this does not work - we see the full output even with -q:

~> pytest --collect-only -qq tests/test_dcos_e2e/backends/docker/test_distributions.py::TestCoreOS::test_oss
============================================================================================= test session starts ==============================================================================================
platform darwin -- Python 3.7.3, pytest-4.4.0, py-1.8.0, pluggy-0.12.0 -- /Users/adam/.virtualenvs/e2e/bin/python3.7
cachedir: .pytest_cache
rootdir: /Users/adam/Documents/repositories/work/mesosphere/dcos-e2e, inifile: setup.cfg
plugins: timeout-1.3.3, cov-2.7.1, requests-mock-1.6.0
collected 1 item                                                                                                                                                                                               
<Package /Users/adam/Documents/repositories/work/mesosphere/dcos-e2e/tests/test_dcos_e2e/backends/docker>
  <Module test_distributions.py>
    Tests for the ``linux_distribution`` option on the Docker backend.
    <Class TestCoreOS>
      Tests for the CoreOS distribution option.
        <Function test_oss>
          DC/OS OSS can start up on CoreOS.

========================================================================================= no tests ran in 0.03 seconds =========================================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: reportingrelated to terminal output and user-facing messages and errors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions