classification
Title: Simple exclusion filter for unittest autodiscovery
Type: enhancement Stage: needs patch
Components: Library (Lib) Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: michael.foord Nosy List: eric.araujo, ezio.melotti, gustavoarzola, michael.foord, ncoghlan
Priority: normal Keywords:

Created on 2011-11-25 01:57 by ncoghlan, last changed 2012-09-30 23:52 by michael.foord.

Messages (4)
msg148299 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2011-11-25 01:57
unittest autodiscovery is very nice, but a '-x' option to specify directory patterns *not* to search could be a nice enhancement.

(In my specific case, I want to run most of my tests, but one batch are Django tests and it would be nice to have an easy way to tell unittest to ignore them)
msg155469 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2012-03-12 20:02
This would be nice (more powerful) as a general test method exclusion filter: so run test discovery or fetch the specified test module / class and then exclude individual tests that match the pattern.

We're looking to add a general test include filter, so it is the natural complement to that.
msg158500 - (view) Author: Gustavo Arzola (gustavoarzola) Date: 2012-04-16 21:15
I use netatalk so that I can edit my projects on my laptop (Mac) but run them on my server (Linux).  Netatalk creates all kinds of .AppleDouble sub-directories that contain files with the same names as the parents, but generally hold icon, desktop location, and other meta information.  When unittest tries to load this files, it generates a ValueError.

I like using "python setup.py tests" on my pyramid projects, but this always fails the moment I look at a directory through my laptop (which creates the .AppleDouble subdirectory).  A -x flag would be more useful if I could specify it on the "python setup.py tests" command line or in a config file or in an environment variable.

I'm sure there are other software products that create hidden subdirectories that may contain file names that might confuse unittest.  So I think a general mechanism rather than a specific one is a better solution.

Also, it would be really nice if unittest printed the full path name of the file it was trying to import before spitting out the error -- it took a _lot_ of hunting and googling in order to understand what was going on.
msg158676 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-04-18 22:18
> A -x flag would be more useful if I could specify it on the "python setup.py tests" command line
The most common distutils test command is part of setuptools, not the standard library.  Other people have also written other test, tests or nosetests commands.  The only test command in the standard library is in packaging (distutils2), so you could open another bug report to request a new option for “pysetup run test”, which would simply pass the option to unittest.
History
Date User Action Args
2012-09-30 23:52:57michael.foordsetassignee: michael.foord
2012-09-30 10:24:12tomwardillsetversions: + Python 3.4, - Python 3.3
2012-04-18 22:18:48eric.araujosetnosy: + eric.araujo

messages: + msg158676
versions: - Python 2.7
2012-04-16 21:15:43gustavoarzolasetnosy: + gustavoarzola

messages: + msg158500
versions: + Python 2.7
2012-03-12 20:02:52michael.foordsetmessages: + msg155469
2011-11-25 01:57:24ezio.melottisetnosy: + ezio.melotti
2011-11-25 01:57:02ncoghlancreate