pythonpython-2.7pytestxdistpython-hunter

No output, even with `py.test -s`


I would like to use py.test combined with hunter:

PYTHONHUNTER="module_startswith='foo'" py.test -s -k test_bar

Unfortunately the output (trace) of hunter is not visible.

Version:

foo_cok_d@aptguettler:~$ py.test --version

This is pytest version 3.4.2, imported from /home/foo_cok_d/local/lib/python2.7/site-packages/pytest.pyc
setuptools registered plugins:
  pytest-xdist-1.22.2 at /home/foo_cok_d/local/lib/python2.7/site-packages/xdist/looponfail.py
  pytest-xdist-1.22.2 at /home/foo_cok_d/local/lib/python2.7/site-packages/xdist/plugin.py
  pytest-forked-0.2 at /home/foo_cok_d/local/lib/python2.7/site-packages/pytest_forked/__init__.pyc

In a simpler (smaller) virtualenv it works (same pytest version, but no plugins).

What could be the reason?

How to debug this?


Solution

  • I found a work-around.

    If I these two lines, then the -s option (shortcut for --capture=no) for py.test works.

        def test_when_the_moon_is_in_the_seventh_house(self):
    +        import hunter
    +        hunter.trace(module_startswith='modlink')
            ...
    

    And I will see the race, and I am happy.

    A solution without modifying the source code would be nice.