diff options
author | jpellerin <devnull@localhost> | 2011-07-25 17:34:08 -0400 |
---|---|---|
committer | jpellerin <devnull@localhost> | 2011-07-25 17:34:08 -0400 |
commit | 9b9b08eb40325940bbf090335135a4835543839a (patch) | |
tree | 5b054039af08368aa7327f5813386da7e2d54ad9 /functional_tests | |
parent | bda95d5e9190b49ee6bc24c3a473d398097ef5e6 (diff) | |
download | nose-9b9b08eb40325940bbf090335135a4835543839a.tar.gz |
Rewrote another doctest, made TestCases safe for older pythons
Diffstat (limited to 'functional_tests')
4 files changed, 44 insertions, 22 deletions
diff --git a/functional_tests/test_multiprocessing/test_nameerror.py b/functional_tests/test_multiprocessing/test_nameerror.py new file mode 100644 index 0000000..f73d02b --- /dev/null +++ b/functional_tests/test_multiprocessing/test_nameerror.py @@ -0,0 +1,31 @@ +import os +import unittest + +from nose.plugins import PluginTester +from nose.plugins.skip import SkipTest +from nose.plugins.multiprocess import MultiProcess + + +support = os.path.join(os.path.dirname(__file__), 'support') + + +def setup(): + try: + import multiprocessing + if 'active' in MultiProcess.status: + raise SkipTest("Multiprocess plugin is active. Skipping tests of " + "plugin itself.") + except ImportError: + raise SkipTest("multiprocessing module not available") + + +class TestMPNameError(PluginTester, unittest.TestCase): + activate = '--processes=2' + plugins = [MultiProcess()] + suitepath = os.path.join(support, 'nameerror.py') + + def runTest(self): + print str(self.output) + assert 'NameError' in self.output + assert "'undefined_variable' is not defined" in self.output + diff --git a/functional_tests/test_multiprocessing/test_nameerror.rst b/functional_tests/test_multiprocessing/test_nameerror.rst deleted file mode 100644 index 076c58f..0000000 --- a/functional_tests/test_multiprocessing/test_nameerror.rst +++ /dev/null @@ -1,21 +0,0 @@ - >>> from os.path import join, dirname - >>> from nose.plugins.plugintest import run_buffered - >>> from nose.plugins.multiprocess import MultiProcess - - >>> def run(*cmd): run_buffered(argv=list(cmd), plugins=[MultiProcess()]) - >>> def path(fname): return join(dirname(__file__), 'support', fname) - - >>> run( 'nosetests', '--processes=2', path('nameerror.py') ) - E - ====================================================================== - ERROR: Failure: NameError (name 'undefined_variable' is not defined) - ---------------------------------------------------------------------- - Traceback (most recent call last): - ... - NameError: name 'undefined_variable' is not defined - <BLANKLINE> - ---------------------------------------------------------------------- - Ran 1 test in ...s - <BLANKLINE> - FAILED (errors=1) - diff --git a/functional_tests/test_multiprocessing/test_nameerror_fixtures.py b/functional_tests/test_multiprocessing/test_nameerror_fixtures.py deleted file mode 100644 index 4e70060..0000000 --- a/functional_tests/test_multiprocessing/test_nameerror_fixtures.py +++ /dev/null @@ -1 +0,0 @@ -from test_keyboardinterrupt_fixtures import setup_module diff --git a/functional_tests/test_multiprocessing/test_process_timeout.py b/functional_tests/test_multiprocessing/test_process_timeout.py index cf531a4..535ecdb 100644 --- a/functional_tests/test_multiprocessing/test_process_timeout.py +++ b/functional_tests/test_multiprocessing/test_process_timeout.py @@ -2,10 +2,23 @@ import os import unittest from nose.plugins import PluginTester +from nose.plugins.skip import SkipTest from nose.plugins.multiprocess import MultiProcess support = os.path.join(os.path.dirname(__file__), 'support') + +def setup(): + try: + import multiprocessing + if 'active' in MultiProcess.status: + raise SkipTest("Multiprocess plugin is active. Skipping tests of " + "plugin itself.") + except ImportError: + raise SkipTest("multiprocessing module not available") + + + class TestMPTimeout(PluginTester, unittest.TestCase): activate = '--processes=2' args = ['--process-timeout=1'] |