I have a directory with a unittest-module and a logs-directory where debug-informations are written.
since I use the -f / --looponfail option, I need changes in the logs-directory to be ignored.
tests$ ls
logs  __pycache__  pytest.ini  test_basic.py
tests$ cat pytest.ini
[pytest]
norecursedirs = logs
python_files = test_*.py
tests$ py.test -h
(...)
[pytest] ini-options in the next pytest.ini|tox.ini|setup.cfg file:
  markers (linelist)       markers for test functions
  norecursedirs (args)     directory patterns to avoid for recursion
  usefixtures (args)       list of default fixtures to be used with this project
  python_files (args)      glob-style file patterns for Python test module discovery
  python_classes (args)    prefixes for Python test class discovery
  python_functions (args)  prefixes for Python test function and method discovery
  addopts (args)           extra command line options
  minversion (string)      minimally required pytest version
  rsyncdirs (pathlist)     list of (relative) paths to be rsynced for remote distributed testing.
  rsyncignore (pathlist)   list of (relative) glob-style paths to be ignored for rsyncing.
  looponfailroots (pathlist) directories to check for changes
Eventually the failing test is invoked in a loop, because changes in logs/test_basic.log are monitored and I wonder why this is so.  The documentation seems clear to me.
looponfailroots now solves this problem. Put this in your setup.cfg:
[tool:pytest]
looponfailroots=mylib
                        pytest-xdist has no option that influences what files are ignored on --looponfail. The norecursedirs only influences what files are collected as tests. 
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With