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

Print module docstrings in spec output #28

Open
codeinthehole opened this issue Mar 12, 2013 · 4 comments
Open

Print module docstrings in spec output #28

codeinthehole opened this issue Mar 12, 2013 · 4 comments

Comments

@codeinthehole
Copy link

I would find it useful if the spec output included the module docstring as well. This would let me set some context for the following TestCases.

Example

For example, for functional tests I end up naming my TestCases things like:

class TestAnAdmin(WebTest):
    def test_can_create_a_new_product(self):
        ...

which outputs as:

An admin
- can create a new product

But the trouble is I end up with lots of TestCases with the same name and the spec output is a little confusing.

Proposal

It would be good if I could use a module docstring to distinguish between test modules. Eg:

"""
Product dashboard
"""

class TestAnAdmin(WebTest):
    def test_can_create_a_new_product(self):
        ...

would lead to something like:

Product dashboard
-----------------
An admin
- can create a new product

Category dashboard
------------------
An admin
- can create a new category

The underlining is optional. It might be better to use a bold font or simply leave it to the docstring to distinguish the module docstrings.

Sensible?

@narfdotpl
Copy link
Contributor

👍

1 similar comment
@LuRsT
Copy link

LuRsT commented Mar 14, 2013

+1

@bitprophet
Copy link
Owner

Neat idea; I haven't run into this need myself because the projects I've been testing end up organized into one test module per class under test, so the "top level" of the test output is naturally pretty distinct/unique. But I can see why testing similar collections of functionality would make the output harder to parse.

Would need to make sure this is actually feasible re: how Nose organizes discovered tests (I haven't poked at that part of Spec in a year or so, so memory hazy) but given I was able to get the rest of things indented it's probably doable somehow. I'd definitely consider merging a PR implementing this, otherwise I may pok when I have time.

@codeinthehole
Copy link
Author

Excellent. I'll have a go at implementing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants