summaryrefslogtreecommitdiff
path: root/unit_tests
diff options
context:
space:
mode:
authorJason Pellerin <jpellerin@gmail.com>2009-05-30 13:33:27 -0400
committerJason Pellerin <jpellerin@gmail.com>2009-05-30 13:33:27 -0400
commit8e64d436922a0c68f9fd2895fea9a1753a9e9090 (patch)
treee4e1fbc1f0287f405e7a8d07b4aa13a70a20c5a2 /unit_tests
parent92b050010fb7bc8b8b774b4df559aec912d95678 (diff)
downloadnose-8e64d436922a0c68f9fd2895fea9a1753a9e9090.tar.gz
Fixed issue 270: packages dispatched to mp worker were not fully loaded
Diffstat (limited to 'unit_tests')
-rw-r--r--unit_tests/support/issue270/__init__.py2
-rw-r--r--unit_tests/support/issue270/foo_test.py7
-rw-r--r--unit_tests/test_issue270.rst24
-rw-r--r--unit_tests/test_issue270_fixtures.py11
4 files changed, 44 insertions, 0 deletions
diff --git a/unit_tests/support/issue270/__init__.py b/unit_tests/support/issue270/__init__.py
new file mode 100644
index 0000000..264b0f9
--- /dev/null
+++ b/unit_tests/support/issue270/__init__.py
@@ -0,0 +1,2 @@
+def setup():
+ pass
diff --git a/unit_tests/support/issue270/foo_test.py b/unit_tests/support/issue270/foo_test.py
new file mode 100644
index 0000000..5a629d3
--- /dev/null
+++ b/unit_tests/support/issue270/foo_test.py
@@ -0,0 +1,7 @@
+class Foo_Test:
+
+ def test_foo(self):
+ pass
+
+ def test_bar(self):
+ pass
diff --git a/unit_tests/test_issue270.rst b/unit_tests/test_issue270.rst
new file mode 100644
index 0000000..b509bfe
--- /dev/null
+++ b/unit_tests/test_issue270.rst
@@ -0,0 +1,24 @@
+Multiprocess test collection from packages
+------------------------------------------
+
+Tests that the multiprocess plugin correctly collects tests from packages
+
+ >>> import os
+ >>> from nose.plugins.plugintest import run_buffered as run
+ >>> from nose.plugins.multiprocess import MultiProcess
+ >>> support = os.path.join(os.path.dirname(__file__), 'support')
+ >>> issue270 = os.path.join(support, 'issue270')
+
+The test package has a package-level fixture, which causes the entire package
+to be dispatched to a multiprocess worker. Tests are still collected and run
+properly.
+
+ >>> argv = [__file__, '-v', '--processes=2', issue270]
+ >>> run(argv=argv, plugins=[MultiProcess()])
+ issue270.foo_test.Foo_Test.test_bar ... ok
+ issue270.foo_test.Foo_Test.test_foo ... ok
+ <BLANKLINE>
+ ----------------------------------------------------------------------
+ Ran 2 tests in ...s
+ <BLANKLINE>
+ OK
diff --git a/unit_tests/test_issue270_fixtures.py b/unit_tests/test_issue270_fixtures.py
new file mode 100644
index 0000000..d18abba
--- /dev/null
+++ b/unit_tests/test_issue270_fixtures.py
@@ -0,0 +1,11 @@
+from nose.plugins.skip import SkipTest
+from nose.plugins.multiprocess import MultiProcess
+
+def setup_module():
+ 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")