diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2013-12-14 13:47:03 -0500 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2013-12-14 13:47:03 -0500 |
| commit | 9d3bc371e31128f6d46f2f9709c5ed8eb5357801 (patch) | |
| tree | 88826ebccb2a3268b0fd82d44daadacd8f4ea4cc /tests | |
| parent | 6954fd99ff252c3f778680f380053989ed1c06ad (diff) | |
| download | python-coveragepy-9d3bc371e31128f6d46f2f9709c5ed8eb5357801.tar.gz | |
Add a test of the pydoc behavior.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_process.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_process.py b/tests/test_process.py index ddbbafd..fa4759a 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -527,6 +527,30 @@ class AliasedCommandTest(CoverageTest): self.assertIn("Code coverage for Python", out) +class PydocTest(CoverageTest): + """Test that pydoc can get our information.""" + + run_in_temp_dir = False + + def assert_pydoc_ok(self, name, thing): + """Check that pydoc of `name` finds the docstring from `thing`.""" + # Run pydoc. + out = self.run_command("python -m pydoc " + name) + # It should say "Help on..", and not have a traceback + self.assert_starts_with(out, "Help on ") + self.assertNotIn("Traceback", out) + + # All of the lines in the docstring should be there somewhere. + for line in thing.__doc__.splitlines(): + self.assertIn(line.strip(), out) + + def test_pydoc_coverage(self): + self.assert_pydoc_ok("coverage", coverage) + + def test_pydoc_coverage_coverage(self): + self.assert_pydoc_ok("coverage.coverage", coverage.coverage) + + class FailUnderTest(CoverageTest): """Tests of the --fail-under switch.""" |
