summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG7
-rw-r--r--functional_tests/test_multiprocessing/test_concurrent_shared.py81
-rw-r--r--functional_tests/test_xunit.py4
-rw-r--r--nose/pyversion.py3
-rw-r--r--nose/util.py9
-rw-r--r--tox.ini8
-rw-r--r--unit_tests/test_config_defaults.rst10
-rw-r--r--unit_tests/test_utils.py3
8 files changed, 72 insertions, 53 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 84bfbe9..ef70f74 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,10 @@
+Under Development
+
+- Fixed #782: Test failures with Python >= 3.3
+ Patch by Dmitry Shachnev.
+- Fixed #780: Fix a regression with Python 3
+- Fixed #783: try_run is broken with Python 3.4
+
1.3.1
- The log capture plugin now correctly applies filters that were added
diff --git a/functional_tests/test_multiprocessing/test_concurrent_shared.py b/functional_tests/test_multiprocessing/test_concurrent_shared.py
index a6fc203..db3bd61 100644
--- a/functional_tests/test_multiprocessing/test_concurrent_shared.py
+++ b/functional_tests/test_multiprocessing/test_concurrent_shared.py
@@ -1,39 +1,42 @@
-import os
-import sys
-import unittest
-
-import multiprocessing
-from test_multiprocessing import MPTestBase
-
-
-is_pypy = '__pypy__' in sys.builtin_module_names
-
-
-class TestConcurrentShared(MPTestBase):
- processes = 2
- suitepath = os.path.join(os.path.dirname(__file__), 'support',
- 'concurrent_shared')
-
- def setUp(self):
- if is_pypy:
- raise unittest.SkipTest('pypy warm-up is too slow; skipping')
-
- # Need to call the base's setUp() routine to get the necessary output
- # capturing.
- MPTestBase.setUp(self)
-
- def runTest(self):
- assert 'Ran 2 tests in 1.' in self.output, "make sure two tests use 1.x seconds (no more than 2 seconds)"
- assert str(self.output).strip().endswith('OK')
-
-
-class TestConcurrentSharedWithAutomaticProcessesCount(TestConcurrentShared):
- """Make sure negative numbers are handled gracefully."""
- processes = -1
-
- def setUp(self):
- if multiprocessing.cpu_count() < 2:
- raise unittest.SkipTest(
- "At least 2 cpus required for this test; skipping")
-
- TestConcurrentShared.setUp(self)
+# This test has been disabled because it's simply too unreliable. There are way
+# too many issues with Travis and other build farms.
+
+# import os
+# import sys
+# import unittest
+#
+# import multiprocessing
+# from test_multiprocessing import MPTestBase
+#
+#
+# is_pypy = '__pypy__' in sys.builtin_module_names
+#
+#
+# class TestConcurrentShared(MPTestBase):
+# processes = 2
+# suitepath = os.path.join(os.path.dirname(__file__), 'support',
+# 'concurrent_shared')
+#
+# def setUp(self):
+# if is_pypy:
+# raise unittest.SkipTest('pypy warm-up is too slow; skipping')
+#
+# # Need to call the base's setUp() routine to get the necessary output
+# # capturing.
+# MPTestBase.setUp(self)
+#
+# def runTest(self):
+# assert 'Ran 2 tests in 1.' in self.output, "make sure two tests use 1.x seconds (no more than 2 seconds)"
+# assert str(self.output).strip().endswith('OK')
+#
+#
+# class TestConcurrentSharedWithAutomaticProcessesCount(TestConcurrentShared):
+# """Make sure negative numbers are handled gracefully."""
+# processes = -1
+#
+# def setUp(self):
+# if multiprocessing.cpu_count() < 2:
+# raise unittest.SkipTest(
+# "At least 2 cpus required for this test; skipping")
+#
+# TestConcurrentShared.setUp(self)
diff --git a/functional_tests/test_xunit.py b/functional_tests/test_xunit.py
index 70e1a52..9f4ac2f 100644
--- a/functional_tests/test_xunit.py
+++ b/functional_tests/test_xunit.py
@@ -86,8 +86,8 @@ class TestIssue680(PluginTester, unittest.TestCase):
def runTest(self):
print str(self.output)
- f = open(xml_results_filename,'r')
- result = f.read()
+ f = open(xml_results_filename,'rb')
+ result = f.read().decode('utf-8')
f.close()
print result
assert 'tests="1" errors="0" failures="0" skip="0"' in result
diff --git a/nose/pyversion.py b/nose/pyversion.py
index fba5ada..8b56614 100644
--- a/nose/pyversion.py
+++ b/nose/pyversion.py
@@ -89,7 +89,8 @@ class UnboundMethod:
self.__dict__ = func.__dict__.copy()
self._func = func
self.__self__ = UnboundSelf(cls)
- self.im_class = cls
+ if sys.version_info < (3, 0):
+ self.im_class = cls
def address(self):
cls = self.__self__.cls
diff --git a/nose/util.py b/nose/util.py
index 7995700..e612696 100644
--- a/nose/util.py
+++ b/nose/util.py
@@ -8,7 +8,7 @@ import re
import sys
import types
import unittest
-from nose.pyversion import ClassType, TypeType, isgenerator
+from nose.pyversion import ClassType, TypeType, isgenerator, ismethod
log = logging.getLogger('nose')
@@ -447,9 +447,10 @@ def try_run(obj, names):
if func is not None:
if type(obj) == types.ModuleType:
# py.test compatibility
- try:
- args, varargs, varkw, defaults = inspect.getargspec(func)
- except TypeError:
+ if isinstance(func, types.FunctionType):
+ args, varargs, varkw, defaults = \
+ inspect.getargspec(func)
+ else:
# Not a function. If it's callable, call it anyway
if hasattr(func, '__call__'):
func = func.__call__
diff --git a/tox.ini b/tox.ini
index 4d3a3e8..321fd13 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist=py33,py32,py31,py27,py26,py25,py24,jython,docs
+envlist=py34,py33,py32,py31,py27,py26,jython,docs
[testenv]
deps= coverage >=3.3
@@ -55,3 +55,9 @@ commands=
rm -fr {toxinidir}/build
{envpython} setup.py build_tests
{envpython} selftest.py []
+
+[testenv:py34]
+commands=
+ rm -fr {toxinidir}/build
+ {envpython} setup.py build_tests
+ {envpython} selftest.py []
diff --git a/unit_tests/test_config_defaults.rst b/unit_tests/test_config_defaults.rst
index 944d370..034f58e 100644
--- a/unit_tests/test_config_defaults.rst
+++ b/unit_tests/test_config_defaults.rst
@@ -89,9 +89,9 @@ Invalid config files
(file-like object)
- >>> options, args = parse([], StringIO("spam"))
+ >>> options, args = parse([], StringIO("spam")) # doctest: +ELLIPSIS
error: Error reading config file '<???>': File contains no section headers.
- file: <???>, line: 1
+ file: ...<???>..., line: 1
'spam'
(filename)
@@ -99,7 +99,7 @@ Invalid config files
>>> options, args = parse([], os.path.join(support, "invalid.cfg"))
... # doctest: +ELLIPSIS
error: Error reading config file '...invalid.cfg': File contains no section headers.
- file: ...invalid.cfg, line: 1
+ file: ...invalid.cfg..., line: 1
'spam\n'
(filenames, length == 1)
@@ -107,7 +107,7 @@ Invalid config files
>>> options, args = parse([], [os.path.join(support, "invalid.cfg")])
... # doctest: +ELLIPSIS
error: Error reading config file '...invalid.cfg': File contains no section headers.
- file: ...invalid.cfg, line: 1
+ file: ...invalid.cfg..., line: 1
'spam\n'
(filenames, length > 1)
@@ -120,7 +120,7 @@ file is bad
... os.path.join(support, "b.cfg")])
... # doctest: +ELLIPSIS
error: Error reading config file '...invalid.cfg': File contains no section headers.
- file: ...invalid.cfg, line: 1
+ file: ...invalid.cfg..., line: 1
'spam\n'
diff --git a/unit_tests/test_utils.py b/unit_tests/test_utils.py
index 2bd837c..cd9ba6e 100644
--- a/unit_tests/test_utils.py
+++ b/unit_tests/test_utils.py
@@ -1,4 +1,5 @@
import os
+import sys
import unittest
import nose
from nose import case
@@ -168,7 +169,7 @@ class TestUtils(unittest.TestCase):
class Bar_m:
def __call__(self, mod):
pass
-
+
foo = imp.new_module('foo')
foo.bar = bar
foo.bar_m = bar_m