summaryrefslogtreecommitdiff
path: root/test/test_testplugin.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2010-05-29 23:51:53 -0400
committerNed Batchelder <ned@nedbatchelder.com>2010-05-29 23:51:53 -0400
commit2fd1d9b7dd96a64e6920dda369a13d95af728394 (patch)
treed6532544f433443c1dc826bfdc6598334a19a4b3 /test/test_testplugin.py
parent879fe9c4721c557a31cb951ef9e0d7a098de319c (diff)
parent343f36c3fe555a196ca59268f71ea4c7838f4d1c (diff)
downloadpython-coveragepy-2fd1d9b7dd96a64e6920dda369a13d95af728394.tar.gz
Merge latest code from main coverage.py repo
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 0000000..87e2e4b
--- /dev/null
+++ b/test/test_testplugin.py
@@ -0,0 +1,36 @@
+import py
+import unittest
+from nose.plugins import PluginTester
+from coverage.noseplugin import Coverage
+
+class TestCoverage(PluginTester, unittest.TestCase):
+ activate = '--with-coverage' # 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?