From 1a6b591c080c84932ba27990d95cbbd356fbacc9 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 25 Nov 2009 18:56:24 +0100 Subject: 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. --- test/test_testplugin.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/test_testplugin.py (limited to 'test') diff --git a/test/test_testplugin.py b/test/test_testplugin.py new file mode 100644 index 0000000..d102a4f --- /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? -- cgit v1.2.1 From 07cc3b6945f600ef84d83367cf9c7a034d2e9865 Mon Sep 17 00:00:00 2001 From: David Stanek Date: Sat, 20 Feb 2010 19:36:21 -0500 Subject: moved the nose plugin to a better name --- test/test_testplugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_testplugin.py b/test/test_testplugin.py index d102a4f..c216ead 100644 --- a/test/test_testplugin.py +++ b/test/test_testplugin.py @@ -1,7 +1,7 @@ import py import unittest from nose.plugins import PluginTester -from coverage.nose_coverage import Coverage +from coverage.noseplugin import Coverage class TestCoverage(PluginTester, unittest.TestCase): activate = '--with-coverage_new' # enables the plugin -- cgit v1.2.1 From 4749c14e6dd316b710419b276c09a90662ed2712 Mon Sep 17 00:00:00 2001 From: David Stanek Date: Fri, 21 May 2010 23:40:04 -0400 Subject: cleaned up the code for the nose plugin --- test/test_testplugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_testplugin.py b/test/test_testplugin.py index c216ead..87e2e4b 100644 --- a/test/test_testplugin.py +++ b/test/test_testplugin.py @@ -4,10 +4,10 @@ from nose.plugins import PluginTester from coverage.noseplugin import Coverage class TestCoverage(PluginTester, unittest.TestCase): - activate = '--with-coverage_new' # enables the plugin + 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, ( -- cgit v1.2.1