#4526 enhancement closed fixed (fixed)
Document how trial finds tests to run
Reported by: | Screwtape | Owned by: | Adi Roiban |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | trial | Keywords: | documentation easy |
Cc: | Thijs Triemstra, E. Dunham | Branch: |
branches/trial-discovery-documentation-4526-2
branch-diff, diff-cov, branch-cov, buildbot |
Author: | adiroiban, rwall |
Description
I've been on a bit of a trial documentation kick recently, and noticed that neither the man page nor the HTML docs discuss the algorithm trial uses when looking for test files.
For example, if I run:
trial my.python.package
then which of the following tests will be found?
TestCase
s defined inmy/python/package/__init__.py
TestCase
s defined inmy/python/package/test_foo.py
TestCase
s defined inmy/python/package/Test_foo.py
TestCase
s defined inmy/python/package/testfoo.py
TestCase
s defined inmy/python/package/Testfoo.py
TestCase
s defined inmy/python/package/foo_test.py
For freshly-written tests designed to work with Trial, I personally always use the test_foo.py
variant, but sometimes when I want to use Trial's test-sniffing features with third-party libraries, or to test legacy code I've inherited, it would be nice to have a place where I could find out definitively what the rules are.
(yes, I suppose I could just run Trial and see, but sometimes it's easier to try nosetests or py.test or run things manually than decipher exactly what failure-mode caused a particular error message)
Attachments (2)
Change History (21)
comment:1 Changed 12 years ago by
Component: | core → trial |
---|---|
Owner: | changed from Glyph to Jonathan Lange |
comment:2 Changed 11 years ago by
Owner: | Jonathan Lange deleted |
---|
comment:3 Changed 11 years ago by
Cc: | Thijs Triemstra added |
---|
comment:4 Changed 9 years ago by
Keywords: | easy added |
---|
comment:5 Changed 9 years ago by
Owner: | set to arbiter |
---|---|
Status: | new → assigned |
comment:6 Changed 9 years ago by
Owner: | arbiter deleted |
---|---|
Status: | assigned → new |
comment:7 Changed 8 years ago by
Cc: | E. Dunham added |
---|---|
Owner: | set to E. Dunham |
Status: | new → assigned |
Changed 8 years ago by
Attachment: | 0001-Update-testing-with-how-Trial-finds-tests.patch added |
---|
comment:8 Changed 8 years ago by
The man page links the howto page from "see also", so no changes to the man page are required. Attached above is a patch which adds a link to the module loader docs from the testing howto.
comment:9 Changed 8 years ago by
Keywords: | review added |
---|---|
Owner: | E. Dunham deleted |
Status: | assigned → new |
comment:10 Changed 8 years ago by
Keywords: | review removed |
---|---|
Owner: | set to E. Dunham |
Thanks for the work on this.
The patch needs a news file. http://twistedmatrix.com/trac/wiki/ReviewProcess#Newsfiles
The preferred format is diff without prefix http://twistedmatrix.com/trac/wiki/GitMirror#CreatingaGitclone
Other than that, it looks good.
Thanks!
Changed 8 years ago by
Attachment: | document-how-trial-finds-tests.patch added |
---|
edunham's work with a NEWS file
comment:11 Changed 8 years ago by
Keywords: | review added |
---|---|
Owner: | E. Dunham deleted |
Hopefully I am not stepping on anyone's toes picking up the ticket edunham has worked on. I have addressed adiroiban's comments by adding a patch with a NEWS file and I used the patch-making instructions from https://twistedmatrix.com/trac/wiki/BasicGuideToContributingCode#SubmitaPatch.
comment:12 Changed 8 years ago by
Owner: | set to Richard Wall |
---|---|
Status: | new → assigned |
comment:13 Changed 8 years ago by
Author: | → rwall |
---|---|
Branch: | → branches/trial-discovery-documentation-4526 |
(In [43147]) Branching to trial-discovery-documentation-4526.
comment:15 Changed 7 years ago by
Author: | rwall → adiroiban, rwall |
---|---|
Branch: | branches/trial-discovery-documentation-4526 → branches/trial-discovery-documentation-4526-2 |
(In [43735]) Branching to trial-discovery-documentation-4526-2.
comment:16 Changed 7 years ago by
Owner: | changed from Richard Wall to Adi Roiban |
---|---|
Status: | assigned → new |
I will sync with trunk and hope is ok... old branch was failing on buildbot
comment:17 Changed 7 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:18 Changed 7 years ago by
Keywords: | review removed |
---|
Don't forget to remove the review keyword when you review a ticket.
Also, the news fragment for this change seems to contain a mistake:
Twisted Trial's basics documentation now has a link to the documentation about how Trial finds tests. Twisted Trial's basics documentation now has a link to the documentation about how Trial finds tests.
Separately, I'm not sure I'd consider this one line doc addition (which is just a reference to other existing documentation) non-misc material.
comment:19 Changed 7 years ago by
hawkowl fixed this in #7335 as the duplicate news line was already merged. I am sorry for letting this pass the review and merged in trunk.
I will remove the review in the future. Thanks for the help!
The answer to this actually is in the docs, just hidden pretty well. Whether a test is run depends not on what file it's in, but on how your module is configured and what its class inherits from.
I guess that references to that documentation should be added to at least the documentation and possibly the man page as well.