summaryrefslogtreecommitdiff
path: root/test/test_testplugin.py
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2009-11-25 18:56:24 +0100
committerholger krekel <holger@merlinux.eu>2009-11-25 18:56:24 +0100
commitb61370af5615d8aa781f1d311fe408e9a036b6da (patch)
tree16dea9256c6110d0bf5fe7c3952010e607fd3fc3 /test/test_testplugin.py
parent66e3cb2383ce60793559453ad3243f70d38d94a1 (diff)
downloadpython-coveragepy-git-b61370af5615d8aa781f1d311fe408e9a036b6da.tar.gz
merging/unifying test plugin code
* coverage/testplugin.py contains common test plugin options and pytest hooks (which don't induce "import py") * coverage/nose_coverage.py contains a basic Nose Plugin * test/test_testplugin.py contains a pytest-functional test and a nose-skeleton one. skipped as appropriate. --HG-- rename : coverage/runner.py => coverage/testplugin.py
Diffstat (limited to 'test/test_testplugin.py')
-rw-r--r--test/test_testplugin.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/test_testplugin.py b/test/test_testplugin.py
new file mode 100644
index 00000000..d102a4f4
--- /dev/null
+++ b/test/test_testplugin.py
@@ -0,0 +1,36 @@
+import py
+import unittest
+from nose.plugins import PluginTester
+from coverage.nose_coverage import Coverage
+
+class TestCoverage(PluginTester, unittest.TestCase):
+ activate = '--with-coverage_new' # enables the plugin
+ plugins = [Coverage()]
+ args = ['--cover-action=report']
+
+ @py.test.mark.skipif(True) # "requires nose test runner"
+ def test_output(self):
+ assert "Processing Coverage..." in self.output, (
+ "got: %s" % self.output)
+ def makeSuite(self):
+ class TC(unittest.TestCase):
+ def runTest(self):
+ raise ValueError("Coverage down")
+ return unittest.TestSuite([TC()])
+
+pytest_plugins = ['pytester']
+def test_functional(testdir):
+ testdir.makepyfile("""
+ def f():
+ x = 42
+ def test_whatever():
+ pass
+ """)
+ result = testdir.runpytest("--cover-action=annotate")
+ assert result.ret == 0
+ assert result.stdout.fnmatch_lines([
+ '*Processing Coverage*'
+ ])
+ coveragefile = testdir.tmpdir.join(".coverage")
+ assert coveragefile.check()
+ # XXX try loading it?