[Python-modules-commits] [nose2] 01/05: Import nose2_0.6.3.orig.tar.gz
Brian May
bam at moszumanska.debian.org
Tue Mar 1 21:57:29 UTC 2016
This is an automated email from the git hooks/post-receive script.
bam pushed a commit to branch master
in repository nose2.
commit 1e5a7fc4fcc231229cb0d0d78368ef3ee72b3b50
Author: Brian May <bam at debian.org>
Date: Wed Mar 2 08:56:16 2016 +1100
Import nose2_0.6.3.orig.tar.gz
---
PKG-INFO | 3 ++-
docs/changelog.rst | 6 ++++++
nose2.egg-info/PKG-INFO | 3 ++-
nose2/plugins/doctests.py | 4 ++--
nose2/tests/_common.py | 26 +++++++++++++++++++++++++
nose2/tests/functional/test_loadtests_plugin.py | 4 +++-
nose2/tests/unit/test_doctest_plugin.py | 6 +++++-
nose2/tests/unit/test_layers_plugin.py | 9 ++++++++-
nose2/tests/unit/test_params_plugin.py | 8 ++++----
nose2/util.py | 18 +++++++++++------
setup.py | 3 ++-
11 files changed, 72 insertions(+), 18 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index a570ca6..b4893c7 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: nose2
-Version: 0.6.2
+Version: 0.6.3
Summary: nose2 is the next generation of nicer testing for Python
Home-page: https://github.com/nose-devs/nose2
Author: Jason Pellerin
@@ -67,6 +67,7 @@ Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Operating System :: OS Independent
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 949745b..ff11d30 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -1,6 +1,12 @@
Changelog
=========
+0.6.3
+-----
+
+* Added
+ * python 3.5 support
+
0.6.2
-----
diff --git a/nose2.egg-info/PKG-INFO b/nose2.egg-info/PKG-INFO
index a570ca6..b4893c7 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.2
+Version: 0.6.3
Summary: nose2 is the next generation of nicer testing for Python
Home-page: https://github.com/nose-devs/nose2
Author: Jason Pellerin
@@ -67,6 +67,7 @@ Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Operating System :: OS Independent
diff --git a/nose2/plugins/doctests.py b/nose2/plugins/doctests.py
index b78df2b..20a25e6 100644
--- a/nose2/plugins/doctests.py
+++ b/nose2/plugins/doctests.py
@@ -53,7 +53,7 @@ class DocTestLoader(Plugin):
try:
suite = doctest.DocTestSuite(module)
except ValueError:
- # doctest, very annoyingly, raises ValueError when
- # a module has no tests.
+ # with python <= 3.5, doctest, very annoyingly, raises ValueError
+ # when a module has no tests.
return
event.extraTests.append(suite)
diff --git a/nose2/tests/_common.py b/nose2/tests/_common.py
index 6b3b9a3..5daec86 100644
--- a/nose2/tests/_common.py
+++ b/nose2/tests/_common.py
@@ -41,6 +41,32 @@ class TestCase(unittest.TestCase):
os.chdir(self._orig_dir)
shutil.rmtree(self._work_dir, ignore_errors=True)
+ def __str__(self):
+ """
+ In python 3.5, the unittest.TestCase.__str__() output changed.
+ This makes it conform to previous version.
+ """
+ if sys.version_info >= (3, 5):
+ test_module = self.__class__.__module__
+ test_class = self.__class__.__name__
+ test_method = self._testMethodName
+ return "%s (%s.%s)" % (test_method, test_module, test_class)
+ else:
+ return super(TestCase, self).__str__()
+
+ def id(self):
+ """
+ In python 3.5, the unittest.TestCase.__id__() output changed.
+ This makes it conform to previous version.
+ """
+ if sys.version_info >= (3, 5):
+ test_module = self.__class__.__module__
+ test_class = self.__class__.__name__
+ test_method = self._testMethodName
+ return "%s.%s.%s" % (test_module, test_class, test_method)
+ else:
+ return super(TestCase, self).id()
+
class FunctionalTestCase(unittest.TestCase):
tags = ['functional']
diff --git a/nose2/tests/functional/test_loadtests_plugin.py b/nose2/tests/functional/test_loadtests_plugin.py
index a559113..7110703 100644
--- a/nose2/tests/functional/test_loadtests_plugin.py
+++ b/nose2/tests/functional/test_loadtests_plugin.py
@@ -27,8 +27,10 @@ class TestLoadTestsPlugin(FunctionalTestCase):
self.assertTestRunOutputMatches(proc, stderr='Ran 2 tests')
self.assertTestRunOutputMatches(
proc, stderr='test..ltpkg.tests.test_find_these.Test')
+ # with python >= 3.5, the test name contains the fully qualified class
+ # name, so the regexp has an optional matching part.
self.assertTestRunOutputMatches(
- proc, stderr='test..ltpkg2.tests.Test')
+ proc, stderr='test..ltpkg2.tests(.load_tests.<locals>)?.Test')
def test_project_directory_inside_package(self):
proc = self.runIn(
diff --git a/nose2/tests/unit/test_doctest_plugin.py b/nose2/tests/unit/test_doctest_plugin.py
index 0a3ccbc..79b2967 100644
--- a/nose2/tests/unit/test_doctest_plugin.py
+++ b/nose2/tests/unit/test_doctest_plugin.py
@@ -1,4 +1,5 @@
"""Test doctests plugin."""
+import sys
import doctest
from nose2 import events, loader, session
@@ -54,7 +55,10 @@ True
def func():
pass
""")
- self.assertEqual(event.extraTests, [])
+ if sys.version_info >= (3, 5):
+ self.assertEqual(event.extraTests, [doctest.DocTestSuite()])
+ else:
+ self.assertEqual(event.extraTests, [])
def _handle_file(self, fpath, content):
"""Have plugin handle a file with certain content.
diff --git a/nose2/tests/unit/test_layers_plugin.py b/nose2/tests/unit/test_layers_plugin.py
index 6f2f8b7..1b05176 100644
--- a/nose2/tests/unit/test_layers_plugin.py
+++ b/nose2/tests/unit/test_layers_plugin.py
@@ -1,3 +1,4 @@
+import sys
from nose2.compat import unittest
from nose2.plugins import layers
from nose2 import events, loader, session
@@ -285,7 +286,13 @@ class TestLayers(TestCase):
def iternames(self, suite):
for t in suite:
if isinstance(t, unittest.TestCase):
- yield str(t)
+ if sys.version_info >= (3, 5):
+ test_module = t.__class__.__module__
+ test_class = t.__class__.__name__
+ test_method = t._testMethodName
+ yield "%s (%s.%s)" % (test_method, test_module, test_class)
+ else:
+ yield str(t)
else:
yield [n for n in self.iternames(t)]
diff --git a/nose2/tests/unit/test_params_plugin.py b/nose2/tests/unit/test_params_plugin.py
index 4dbf545..47f65ec 100644
--- a/nose2/tests/unit/test_params_plugin.py
+++ b/nose2/tests/unit/test_params_plugin.py
@@ -94,10 +94,10 @@ class TestParams(TestCase):
self.assertEqual(len(event.extraTests), 1)
self.assertEqual(len(event.extraTests[0]._tests), 2)
# check that test names are sensible
- self.assertEqual(util.test_name(event.extraTests[0]._tests[0]),
- 'themod.Test.test:1')
- self.assertEqual(util.test_name(event.extraTests[0]._tests[1]),
- 'themod.Test.test:2')
+ t1 = util.test_name(event.extraTests[0]._tests[0], qualname=False)
+ self.assertEqual(t1, 'themod.Test.test:1')
+ t2 = util.test_name(event.extraTests[0]._tests[1], qualname=False)
+ self.assertEqual(t2, 'themod.Test.test:2')
def test_can_load_tests_from_parameterized_by_cartesian_params_methods(self):
class Mod(object):
diff --git a/nose2/util.py b/nose2/util.py
index 6a5570e..d968793 100644
--- a/nose2/util.py
+++ b/nose2/util.py
@@ -61,12 +61,12 @@ def valid_module_name(path):
def name_from_path(path):
"""Translate ``path`` into module name
- Returns a two-element tuple:
-
+ Returns a two-element tuple:
+
1. a dotted module name that can be used in an import statement
(e.g., ``pkg1.test.test_things``)
-
- 2. a full path to filesystem directory, which must be on ``sys.path``
+
+ 2. a full path to filesystem directory, which must be on ``sys.path``
for the import to succeed.
"""
@@ -135,14 +135,20 @@ def name_from_args(name, index, args):
return '%s:%s\n%s' % (name, index + 1, summary[:79])
-def test_name(test):
+def test_name(test, qualname=True):
# XXX does not work for test funcs; test.id() lacks module
if hasattr(test, '_funcName'):
tid = test._funcName
elif hasattr(test, '_testFunc'):
tid = "%s.%s" % (test._testFunc.__module__, test._testFunc.__name__)
else:
- tid = test.id()
+ if sys.version_info >= (3, 5) and not qualname:
+ test_module = test.__class__.__module__
+ test_class = test.__class__.__name__
+ test_method = test._testMethodName
+ tid = "%s.%s.%s" % (test_module, test_class, test_method)
+ else:
+ tid = test.id()
if '\n' in tid:
tid = tid.split('\n')[0]
return tid
diff --git a/setup.py b/setup.py
index ef348b3..b183531 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@ import os
import sys
NAME = 'nose2'
-VERSION = '0.6.2'
+VERSION = '0.6.3'
PACKAGES = ['nose2', 'nose2.plugins', 'nose2.plugins.loader',
'nose2.tests', 'nose2.tests.functional', 'nose2.tests.unit',
'nose2.tools', 'nose2.backports']
@@ -23,6 +23,7 @@ CLASSIFIERS = [
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Operating System :: OS Independent',
--
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