[Python-modules-commits] [nose2] 01/05: Import nose2_0.6.4.orig.tar.gz
Barry Warsaw
barry at moszumanska.debian.org
Wed Mar 16 20:31:26 UTC 2016
This is an automated email from the git hooks/post-receive script.
barry pushed a commit to branch master
in repository nose2.
commit 61895997adabb16061be85c7fbf178961bf7d474
Author: Barry Warsaw <barry at python.org>
Date: Wed Mar 16 16:23:14 2016 -0400
Import nose2_0.6.4.orig.tar.gz
---
PKG-INFO | 2 +-
docs/changelog.rst | 6 ++++++
nose2.egg-info/PKG-INFO | 2 +-
nose2/plugins/mp.py | 10 ++++++---
nose2/tests/_common.py | 8 ++++----
nose2/tests/functional/test_mp_plugin.py | 35 ++++++++++++++++++++++++++++++++
setup.py | 2 +-
7 files changed, 55 insertions(+), 10 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index b4893c7..88fbb73 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: nose2
-Version: 0.6.3
+Version: 0.6.4
Summary: nose2 is the next generation of nicer testing for Python
Home-page: https://github.com/nose-devs/nose2
Author: Jason Pellerin
diff --git a/docs/changelog.rst b/docs/changelog.rst
index ff11d30..bc85d6d 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -1,6 +1,12 @@
Changelog
=========
+0.6.4
+-----
+
+* Fixed
+ * fix deadlock in mp plugin
+
0.6.3
-----
diff --git a/nose2.egg-info/PKG-INFO b/nose2.egg-info/PKG-INFO
index b4893c7..88fbb73 100644
--- a/nose2.egg-info/PKG-INFO
+++ b/nose2.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: nose2
-Version: 0.6.3
+Version: 0.6.4
Summary: nose2 is the next generation of nicer testing for Python
Home-page: https://github.com/nose-devs/nose2
Author: Jason Pellerin
diff --git a/nose2/plugins/mp.py b/nose2/plugins/mp.py
index 76da8e9..4c8fb1b 100644
--- a/nose2/plugins/mp.py
+++ b/nose2/plugins/mp.py
@@ -69,7 +69,7 @@ class MultiProcess(events.Plugin):
def _runmp(self, test, result):
flat = list(self._flatten(test))
- procs = self._startProcs()
+ procs = self._startProcs(len(flat))
# send one initial task to each process
for proc, conn in procs:
@@ -92,6 +92,7 @@ class MultiProcess(events.Plugin):
if remote_events is None:
# XXX proc is done, how to mark it dead?
+ log.debug("Conn closed %s", conn)
rdrs.remove(conn)
continue
@@ -157,11 +158,13 @@ class MultiProcess(events.Plugin):
else:
return parent_conn
- def _startProcs(self):
+ def _startProcs(self, test_count):
# XXX create session export
session_export = self._exportSession()
procs = []
- for i in range(0, self.procs):
+ count = min(test_count, self.procs)
+ log.debug("Creating %i worker processes", count)
+ for i in range(0, count):
parent_conn, child_conn = self._prepConns()
proc = multiprocessing.Process(
target=procserver, args=(session_export, child_conn))
@@ -177,6 +180,7 @@ class MultiProcess(events.Plugin):
# or module fixtures and group them that way into names
# of test classes or modules
# ALSO record all test cases in self.cases
+ log.debug("Flattening test into list of IDs")
mods = {}
classes = {}
stack = [suite]
diff --git a/nose2/tests/_common.py b/nose2/tests/_common.py
index 5daec86..d6cdfa0 100644
--- a/nose2/tests/_common.py
+++ b/nose2/tests/_common.py
@@ -92,8 +92,8 @@ class FunctionalTestCase(unittest.TestCase):
def runIn(self, testdir, *args, **kw):
return run_nose2(*args, cwd=testdir, **kw)
- def runModuleAsMain(self, testmodule):
- return run_module_as_main(testmodule)
+ def runModuleAsMain(self, testmodule, *args):
+ return run_module_as_main(testmodule, *args)
class _FakeEventBase(object):
@@ -186,10 +186,10 @@ def run_nose2(*nose2_args, **nose2_kwargs):
return NotReallyAProc(nose2_args, **nose2_kwargs)
-def run_module_as_main(test_module):
+def run_module_as_main(test_module, *args):
if not os.path.isabs(test_module):
test_module = support_file(test_module)
- return subprocess.Popen([sys.executable, test_module],
+ return subprocess.Popen([sys.executable, test_module] + list(args),
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
diff --git a/nose2/tests/functional/test_mp_plugin.py b/nose2/tests/functional/test_mp_plugin.py
index 7e44939..ec3e1f1 100644
--- a/nose2/tests/functional/test_mp_plugin.py
+++ b/nose2/tests/functional/test_mp_plugin.py
@@ -6,6 +6,7 @@ from nose2.plugins.mp import MultiProcess, procserver
from nose2.plugins import buffer
from nose2.plugins.loader import discovery, testcases
from nose2.tests._common import FunctionalTestCase, support_file, Conn
+from six.moves import queue
import multiprocessing
import threading
import time
@@ -223,3 +224,37 @@ class MPPluginTestRuns(FunctionalTestCase):
self.assertTestRunOutputMatches(proc, stderr='Ran 600 tests')
self.assertEqual(proc.poll(), 0)
+ def test_too_many_procs(self):
+ # Just need to run the mp plugin with less tests than
+ # processes.
+ proc = self.runModuleAsMain('scenario/one_test/tests.py',
+ '--log-level=debug',
+ '--plugin=nose2.plugins.mp',
+ '-N=2')
+ ret_vals = queue.Queue()
+
+ def save_return():
+ """
+ Popen.communciate() blocks. Use a thread-safe queue
+ to return any exceptions. Ideally, this completes
+ and returns None.
+ """
+ try:
+ self.assertTestRunOutputMatches(proc,
+ stderr='Ran 1 test')
+ self.assertEqual(proc.poll(), 0)
+ ret_vals.put(None)
+ except Exception as exc:
+ ret_vals.put(exc)
+ thread = threading.Thread(target=save_return)
+ thread.start()
+
+ # 1 minute should be more than sufficent for this
+ # little test case.
+ try:
+ exc = ret_vals.get(True, 60)
+ except queue.Empty:
+ exc = "MP Test timed out"
+ proc.kill()
+ self.assertIsNone(exc, str(exc))
+
diff --git a/setup.py b/setup.py
index b183531..d556a05 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@ import os
import sys
NAME = 'nose2'
-VERSION = '0.6.3'
+VERSION = '0.6.4'
PACKAGES = ['nose2', 'nose2.plugins', 'nose2.plugins.loader',
'nose2.tests', 'nose2.tests.functional', 'nose2.tests.unit',
'nose2.tools', 'nose2.backports']
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/nose2.git
More information about the Python-modules-commits
mailing list