From b61370af5615d8aa781f1d311fe408e9a036b6da 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. --HG-- rename : coverage/runner.py => coverage/testplugin.py --- 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 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? -- cgit v1.2.1 From 7ccdc87d3e4ad3a7933c3fc34e37213f36f3229a 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 --HG-- rename : coverage/nose_coverage.py => coverage/noseplugin.py --- 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 d102a4f4..c216ead6 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