PageRenderTime 24ms CodeModel.GetById 17ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/functional_tests/test_multiprocessing/test_nameerror.py

https://bitbucket.org/jpellerin/nose/
Python | 31 lines | 22 code | 9 blank | 0 comment | 4 complexity | 6d7da6431ca875b07a985054f7980c2c MD5 | raw file
 1import os
 2import unittest
 3
 4from nose.plugins import PluginTester
 5from nose.plugins.skip import SkipTest
 6from nose.plugins.multiprocess import MultiProcess
 7
 8
 9support = os.path.join(os.path.dirname(__file__), 'support')
10
11
12def setup():
13    try:
14        import multiprocessing
15        if 'active' in MultiProcess.status:
16            raise SkipTest("Multiprocess plugin is active. Skipping tests of "
17                           "plugin itself.")
18    except ImportError:
19        raise SkipTest("multiprocessing module not available")
20
21
22class TestMPNameError(PluginTester, unittest.TestCase):
23    activate = '--processes=2'
24    plugins = [MultiProcess()]
25    suitepath = os.path.join(support, 'nameerror.py')
26
27    def runTest(self):
28        print str(self.output)
29        assert 'NameError' in self.output
30        assert "'undefined_variable' is not defined" in self.output
31