-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add new testdirs ini option #823
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
Conversation
Looks good, just one consideration: We might consider specifying wildcarded paths in the future such as "tests//test*.py or "app//tests/test*.py" in which case it might be better to name the ini option "testpaths" instead of "testdirs". |
[pytest] | ||
norecursedirs = .svn _build tmp* | ||
|
||
This would tell ``pytest`` to not look into typical subversion or | ||
sphinx-build directories or into any ``tmp`` prefixed directory. | ||
|
||
.. confval:: testdirs | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if we can add .. versionadded::
here
Good point, I will change it later. 😄 |
4c7d4c3
to
53884a3
Compare
@hpk42 changed to |
a09affe
to
aef416c
Compare
if os.getcwd() == self.rootdir: | ||
args = self.getini('testpaths') | ||
if not args: | ||
args = [os.getcwd()] | ||
self.args = args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit. os.getcwd() should be assigned to a var and then this var used instead of potentially calling it twice IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, done.
c37310e
to
870f6fa
Compare
870f6fa
to
854e603
Compare
Rebased on master to account for the mock fix for py26. |
Add new testdirs ini option
As discussed in #694, but not exactly as described in there. Usually projects have a well defined location for tests (pytest for example is
testing
), so an option to specify which directories to look for tests when executing pytest without arguments from the root directory seems useful.