X Tutup
The Wayback Machine - https://web.archive.org/web/20221028173843/https://github.com/python/cpython/issues/57685
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple exclusion filter for unittest autodiscovery #57685

Open
ncoghlan opened this issue Nov 25, 2011 · 4 comments
Open

Simple exclusion filter for unittest autodiscovery #57685

ncoghlan opened this issue Nov 25, 2011 · 4 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@ncoghlan
Copy link
Contributor

ncoghlan commented Nov 25, 2011

BPO 13476
Nosy @ncoghlan, @ezio-melotti, @merwok, @voidspace

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/voidspace'
closed_at = None
created_at = <Date 2011-11-25.01:57:02.616>
labels = ['type-feature', 'library']
title = 'Simple exclusion filter for unittest autodiscovery'
updated_at = <Date 2012-09-30.23:52:57.842>
user = 'https://github.com/ncoghlan'

bugs.python.org fields:

activity = <Date 2012-09-30.23:52:57.842>
actor = 'michael.foord'
assignee = 'michael.foord'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2011-11-25.01:57:02.616>
creator = 'ncoghlan'
dependencies = []
files = []
hgrepos = []
issue_num = 13476
keywords = []
message_count = 4.0
messages = ['148299', '155469', '158500', '158676']
nosy_count = 5.0
nosy_names = ['ncoghlan', 'ezio.melotti', 'eric.araujo', 'michael.foord', 'gustavoarzola']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue13476'
versions = ['Python 3.4']

@ncoghlan
Copy link
Contributor Author

ncoghlan commented Nov 25, 2011

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)

@ncoghlan ncoghlan added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 25, 2011
@voidspace
Copy link
Contributor

voidspace commented Mar 12, 2012

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.

@gustavoarzola
Copy link
Mannequin

gustavoarzola mannequin commented Apr 16, 2012

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.

@merwok
Copy link
Member

merwok commented Apr 18, 2012

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.

@voidspace voidspace self-assigned this Sep 30, 2012
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
Status: No status
Development

No branches or pull requests

3 participants
X Tutup