How do I just run doctests in one module, and not all tests everywhere?

3 views
Skip to first unread message

Matt Wilson

unread,
Sep 16, 2008, 3:33:01 PM9/16/08
to nose-users
I have doctests in my modules and I have tests/ subdirectory with lots
more tests.

Some times I just want to execute the doctests for one particular
function in one module, so I do this:

$ nosetests --with-doctests mymodule.py:my_function

That works OK. But is there a better way?

If I run

$ nosetests

then nose will run every test in my tests/ directory.

Matt

jason pellerin

unread,
Sep 17, 2008, 3:18:01 PM9/17/08
to nose-...@googlegroups.com
On Tue, Sep 16, 2008 at 3:33 PM, Matt Wilson <mw4...@gmail.com> wrote:

> Some times I just want to execute the doctests for one particular
> function in one module, so I do this:
>
> $ nosetests --with-doctests mymodule.py:my_function
>
> That works OK. But is there a better way?

Nope. That's the way specifying which tests to run works. I'm not sure
how else it *could* work -- do you have any suggestions? When you ask
if there's a better way, what do you have in mind? What's better than
passing test names on the command line?

JP

Matt Wilson

unread,
Sep 17, 2008, 10:43:34 PM9/17/08
to nose-users
On Sep 17, 3:18 pm, "jason pellerin" <jpelle...@gmail.com> wrote:
How could I run all the doctests in a particular file? That's what I
couldn't figure out.

Matt

Brandon Pedersen

unread,
Sep 17, 2008, 11:27:24 PM9/17/08
to nose-...@googlegroups.com
On Wed, Sep 17, 2008 at 8:43 PM, Matt Wilson <mw4...@gmail.com> wrote:

How could I run all the doctests in a particular file?  That's what I
couldn't figure out.

Instead of doing 
$ nosetests --with-doctests mymodule.py:my_function
do
$ nosetests --with-doctests mymodule.py

-Brandon
Reply all
Reply to author
Forward
0 new messages