/functional_tests/test_multiprocessing/test_nameerror.py

https://bitbucket.org/jpellerin/nose/ · Python · 31 lines · 22 code · 9 blank · 0 comment · 3 complexity · 6d7da6431ca875b07a985054f7980c2c MD5 · raw file

  1. import os
  2. import unittest
  3. from nose.plugins import PluginTester
  4. from nose.plugins.skip import SkipTest
  5. from nose.plugins.multiprocess import MultiProcess
  6. support = os.path.join(os.path.dirname(__file__), 'support')
  7. def setup():
  8. try:
  9. import multiprocessing
  10. if 'active' in MultiProcess.status:
  11. raise SkipTest("Multiprocess plugin is active. Skipping tests of "
  12. "plugin itself.")
  13. except ImportError:
  14. raise SkipTest("multiprocessing module not available")
  15. class TestMPNameError(PluginTester, unittest.TestCase):
  16. activate = '--processes=2'
  17. plugins = [MultiProcess()]
  18. suitepath = os.path.join(support, 'nameerror.py')
  19. def runTest(self):
  20. print str(self.output)
  21. assert 'NameError' in self.output
  22. assert "'undefined_variable' is not defined" in self.output