Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 698
guettli Avatar asked Feb 14 '19 09:02

guettli


1 Answers

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.

like image 50
guettli Avatar answered Nov 15 '22 15:11

guettli