From 91c6bef77a674d5cd79af464e5c19745427b5510 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 15 Feb 2017 14:55:12 +0100 Subject: [PATCH] Add venv to the default norecursedirs venv (without a dot) is commonly used as a name for a virtualenv directory, and we don't want to collect that. --- CHANGELOG.rst | 3 +++ _pytest/main.py | 2 +- doc/en/customize.rst | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 816d3eb5b..4abc183d0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -51,6 +51,9 @@ Changes additional parameter. Thanks `@unsignedint`_ for the PR. +* Add ``venv`` to the default ``norecursedirs`` setting. + Thanks `@The-Compiler`_ for the PR. + .. _@davidszotten: https://github.com/davidszotten .. _@fushi: https://github.com/fushi diff --git a/_pytest/main.py b/_pytest/main.py index 41a48cda2..73858e099 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -27,7 +27,7 @@ EXIT_NOTESTSCOLLECTED = 5 def pytest_addoption(parser): parser.addini("norecursedirs", "directory patterns to avoid for recursion", - type="args", default=['.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg']) + type="args", default=['.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg', 'venv']) parser.addini("testpaths", "directories to search for tests when no files or directories are given in the command line.", type="args", default=[]) #parser.addini("dirpatterns", diff --git a/doc/en/customize.rst b/doc/en/customize.rst index d12a49037..c6d3eb473 100644 --- a/doc/en/customize.rst +++ b/doc/en/customize.rst @@ -158,7 +158,7 @@ Builtin configuration file options [seq] matches any character in seq [!seq] matches any char not in seq - Default patterns are ``'.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg'``. + Default patterns are ``'.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg', 'venv'``. Setting a ``norecursedirs`` replaces the default. Here is an example of how to avoid certain directories: