using zope.testrunner instead of nose & update python version
(cherry picked from commit e1bf516e7667b4bcbc5a6660d95877f0ab22cf47)
This commit is contained in:
parent
091746490c
commit
b4bfb71517
269
Test-using-zope.testrunner-rather-than-nose.patch
Normal file
269
Test-using-zope.testrunner-rather-than-nose.patch
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
From dac7edd85c6f6a757a32bde76dcae7778c060f34 Mon Sep 17 00:00:00 2001
|
||||||
|
From: chen-jan <chen_aka_jan@163.com>
|
||||||
|
Date: Fri, 7 Jan 2022 05:00:45 +0800
|
||||||
|
Subject: [PATCH] test
|
||||||
|
|
||||||
|
---
|
||||||
|
lazr/delegates/docs/fixture.py | 34 --------------
|
||||||
|
lazr/delegates/docs/usage_fixture.py | 27 -----------
|
||||||
|
lazr/delegates/tests/test_docs.py | 67 ++++++++++++++++++++++++++++
|
||||||
|
lazr/delegates/tests/test_python2.py | 11 +----
|
||||||
|
setup.cfg | 15 -------
|
||||||
|
setup.py | 7 +--
|
||||||
|
tox.ini | 17 ++++++-
|
||||||
|
7 files changed, 85 insertions(+), 93 deletions(-)
|
||||||
|
delete mode 100644 lazr/delegates/docs/fixture.py
|
||||||
|
delete mode 100644 lazr/delegates/docs/usage_fixture.py
|
||||||
|
create mode 100644 lazr/delegates/tests/test_docs.py
|
||||||
|
delete mode 100644 setup.cfg
|
||||||
|
|
||||||
|
diff --git a/lazr/delegates/docs/fixture.py b/lazr/delegates/docs/fixture.py
|
||||||
|
deleted file mode 100644
|
||||||
|
index 1d4aced..0000000
|
||||||
|
--- a/lazr/delegates/docs/fixture.py
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,34 +0,0 @@
|
||||||
|
-# Copyright 2009-2015 Canonical Ltd. All rights reserved.
|
||||||
|
-#
|
||||||
|
-# This file is part of lazr.delegates
|
||||||
|
-#
|
||||||
|
-# lazr.delegates is free software: you can redistribute it and/or modify it
|
||||||
|
-# under the terms of the GNU Lesser General Public License as published by
|
||||||
|
-# the Free Software Foundation, version 3 of the License.
|
||||||
|
-#
|
||||||
|
-# lazr.delegates is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
-# License for more details.
|
||||||
|
-#
|
||||||
|
-# You should have received a copy of the GNU Lesser General Public License
|
||||||
|
-# along with lazr.delegates. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-
|
||||||
|
-"""Doctest fixtures for running under nose."""
|
||||||
|
-
|
||||||
|
-from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
-
|
||||||
|
-__metaclass__ = type
|
||||||
|
-__all__ = [
|
||||||
|
- 'globs',
|
||||||
|
- ]
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-def globs(globs):
|
||||||
|
- """Set up globals for doctests."""
|
||||||
|
- # Enable future statements to make Python 2 act more like Python 3.
|
||||||
|
- globs['absolute_import'] = absolute_import
|
||||||
|
- globs['print_function'] = print_function
|
||||||
|
- globs['unicode_literals'] = unicode_literals
|
||||||
|
- # Provide a convenient way to clean things up at the end of the test.
|
||||||
|
- return globs
|
||||||
|
diff --git a/lazr/delegates/docs/usage_fixture.py b/lazr/delegates/docs/usage_fixture.py
|
||||||
|
deleted file mode 100644
|
||||||
|
index 7012cf7..0000000
|
||||||
|
--- a/lazr/delegates/docs/usage_fixture.py
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,27 +0,0 @@
|
||||||
|
-# Copyright 2009-2015 Canonical Ltd. All rights reserved.
|
||||||
|
-#
|
||||||
|
-# This file is part of lazr.delegates
|
||||||
|
-#
|
||||||
|
-# lazr.delegates is free software: you can redistribute it and/or modify it
|
||||||
|
-# under the terms of the GNU Lesser General Public License as published by
|
||||||
|
-# the Free Software Foundation, version 3 of the License.
|
||||||
|
-#
|
||||||
|
-# lazr.delegates is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
-# License for more details.
|
||||||
|
-#
|
||||||
|
-# You should have received a copy of the GNU Lesser General Public License
|
||||||
|
-# along with lazr.delegates. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-
|
||||||
|
-"""Doctest fixtures for running under nose."""
|
||||||
|
-
|
||||||
|
-from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
-
|
||||||
|
-__metaclass__ = type
|
||||||
|
-__all__ = [
|
||||||
|
- 'globs',
|
||||||
|
- ]
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-from lazr.delegates.docs.fixture import globs
|
||||||
|
diff --git a/lazr/delegates/tests/test_docs.py b/lazr/delegates/tests/test_docs.py
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..7ca6971
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/lazr/delegates/tests/test_docs.py
|
||||||
|
@@ -0,0 +1,67 @@
|
||||||
|
+# Copyright 2009-2021 Canonical Ltd. All rights reserved.
|
||||||
|
+#
|
||||||
|
+# This file is part of lazr.delegates.
|
||||||
|
+#
|
||||||
|
+# lazr.delegates is free software: you can redistribute it and/or modify it
|
||||||
|
+# under the terms of the GNU Lesser General Public License as published by
|
||||||
|
+# the Free Software Foundation, version 3 of the License.
|
||||||
|
+#
|
||||||
|
+# lazr.delegates is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
+# License for more details.
|
||||||
|
+#
|
||||||
|
+# You should have received a copy of the GNU Lesser General Public License
|
||||||
|
+# along with lazr.delegates. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
+
|
||||||
|
+"""Test harness for doctests."""
|
||||||
|
+
|
||||||
|
+from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
+
|
||||||
|
+__metaclass__ = type
|
||||||
|
+__all__ = []
|
||||||
|
+
|
||||||
|
+import atexit
|
||||||
|
+import doctest
|
||||||
|
+import os
|
||||||
|
+
|
||||||
|
+from pkg_resources import (
|
||||||
|
+ resource_filename,
|
||||||
|
+ resource_exists,
|
||||||
|
+ resource_listdir,
|
||||||
|
+ cleanup_resources,
|
||||||
|
+)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+DOCTEST_FLAGS = (
|
||||||
|
+ doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_NDIFF
|
||||||
|
+)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def load_tests(loader, tests, pattern):
|
||||||
|
+ """Load the doc tests (docs/*, if any exist)."""
|
||||||
|
+ doctest_files = []
|
||||||
|
+ if resource_exists("lazr.delegates", "docs"):
|
||||||
|
+ for name in resource_listdir("lazr.delegates", "docs"):
|
||||||
|
+ if name.endswith(".rst"):
|
||||||
|
+ doctest_files.append(
|
||||||
|
+ os.path.abspath(
|
||||||
|
+ resource_filename("lazr.delegates", "docs/%s" % name)
|
||||||
|
+ )
|
||||||
|
+ )
|
||||||
|
+ atexit.register(cleanup_resources)
|
||||||
|
+ globs = {
|
||||||
|
+ "absolute_import": absolute_import,
|
||||||
|
+ "print_function": print_function,
|
||||||
|
+ "unicode_literals": unicode_literals,
|
||||||
|
+ }
|
||||||
|
+ tests.addTest(
|
||||||
|
+ doctest.DocFileSuite(
|
||||||
|
+ *doctest_files,
|
||||||
|
+ module_relative=False,
|
||||||
|
+ optionflags=DOCTEST_FLAGS,
|
||||||
|
+ globs=globs,
|
||||||
|
+ encoding="UTF-8"
|
||||||
|
+ )
|
||||||
|
+ )
|
||||||
|
+ return tests
|
||||||
|
diff --git a/lazr/delegates/tests/test_python2.py b/lazr/delegates/tests/test_python2.py
|
||||||
|
index 1cc873b..ad3de7e 100644
|
||||||
|
--- a/lazr/delegates/tests/test_python2.py
|
||||||
|
+++ b/lazr/delegates/tests/test_python2.py
|
||||||
|
@@ -63,14 +63,7 @@ class BaseOtherFoo(BaseFoo):
|
||||||
|
another = 'yes, another'
|
||||||
|
|
||||||
|
|
||||||
|
-# Python 2.6 doesn't have skips.
|
||||||
|
-def skip_python3(cls):
|
||||||
|
- if sys.version_info[0] > 2:
|
||||||
|
- return None
|
||||||
|
- return cls
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-@skip_python3
|
||||||
|
+@unittest.skipIf(sys.version_info[0] > 2, "only relevant in Python 2")
|
||||||
|
class TestLegacyAPI(unittest.TestCase):
|
||||||
|
def test_basic_usage(self):
|
||||||
|
class SomeClass(object):
|
||||||
|
@@ -146,7 +139,7 @@ class TestLegacyAPI(unittest.TestCase):
|
||||||
|
self.assertTrue(IOther.providedBy(foo_with_teapot))
|
||||||
|
|
||||||
|
|
||||||
|
-@skip_python3
|
||||||
|
+@unittest.skipIf(sys.version_info[0] > 2, "only relevant in Python 2")
|
||||||
|
class TestNewAPI(unittest.TestCase):
|
||||||
|
"""Test corner cases in Python 2.
|
||||||
|
|
||||||
|
diff --git a/setup.cfg b/setup.cfg
|
||||||
|
deleted file mode 100644
|
||||||
|
index ffe1614..0000000
|
||||||
|
--- a/setup.cfg
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,15 +0,0 @@
|
||||||
|
-[nosetests]
|
||||||
|
-verbosity = 3
|
||||||
|
-with-coverage = 1
|
||||||
|
-with-doctest = 1
|
||||||
|
-doctest-extension = .rst
|
||||||
|
-doctest-options = +ELLIPSIS,+NORMALIZE_WHITESPACE,+REPORT_NDIFF
|
||||||
|
-doctest-fixtures = _fixture
|
||||||
|
-cover-package = lazr.delegates
|
||||||
|
-pdb = 1
|
||||||
|
-
|
||||||
|
-[egg_info]
|
||||||
|
-tag_build =
|
||||||
|
-tag_date = 0
|
||||||
|
-tag_svn_revision = 0
|
||||||
|
-
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index 8e16e49..c40bdbf 100755
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -37,7 +37,6 @@ delegating behavior.
|
||||||
|
""",
|
||||||
|
license='LGPL v3',
|
||||||
|
install_requires=[
|
||||||
|
- 'nose',
|
||||||
|
'setuptools',
|
||||||
|
'zope.interface',
|
||||||
|
],
|
||||||
|
@@ -49,12 +48,8 @@ delegating behavior.
|
||||||
|
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
|
||||||
|
"Operating System :: OS Independent",
|
||||||
|
'Programming Language :: Python',
|
||||||
|
- 'Programming Language :: Python :: 2.6',
|
||||||
|
'Programming Language :: Python :: 2.7',
|
||||||
|
'Programming Language :: Python :: 3',
|
||||||
|
+ 'Programming Language :: Python :: 3.9',
|
||||||
|
],
|
||||||
|
- # nose plugins don't really work with `python setup.py test` so use
|
||||||
|
- # `python setup.py nosetests` instead, or just `tox`. Gosh, we really
|
||||||
|
- # should switch to nose2. :/ - BAW 2014-08-20
|
||||||
|
- #test_suite='nose.collector',
|
||||||
|
)
|
||||||
|
diff --git a/tox.ini b/tox.ini
|
||||||
|
index 12a635e..db96714 100644
|
||||||
|
--- a/tox.ini
|
||||||
|
+++ b/tox.ini
|
||||||
|
@@ -1,5 +1,18 @@
|
||||||
|
[tox]
|
||||||
|
-envlist = py27,py32,py33,py34,py35
|
||||||
|
+envlist =
|
||||||
|
+ py27
|
||||||
|
+ py32
|
||||||
|
+ py33
|
||||||
|
+ py34
|
||||||
|
+ py35
|
||||||
|
+ py36
|
||||||
|
+ py37
|
||||||
|
+ py38
|
||||||
|
+ py39
|
||||||
|
+ coverage
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
-commands = python setup.py nosetests
|
||||||
|
+deps =
|
||||||
|
+ .
|
||||||
|
+ zope.testrunner
|
||||||
|
+commands =
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
@ -1,13 +1,15 @@
|
|||||||
%global _empty_manifest_terminate_build 0
|
%global _empty_manifest_terminate_build 0
|
||||||
Name: python-lazr.delegates
|
Name: python-lazr.delegates
|
||||||
Version: 2.0.4
|
Version: 2.0.4
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: Easily write objects that delegate behavior
|
Summary: Easily write objects that delegate behavior
|
||||||
License: LGPL v3
|
License: LGPL v3
|
||||||
URL: https://pypi.org/project/lazr.delegates
|
URL: https://pypi.org/project/lazr.delegates
|
||||||
Source0: https://files.pythonhosted.org/packages/e7/23/c3f5e887055b4f238cf07b47d2ff72731b88858d36ef6095380515dcb8d1/lazr.delegates-%{version}.tar.gz
|
Source0: https://files.pythonhosted.org/packages/e7/23/c3f5e887055b4f238cf07b47d2ff72731b88858d36ef6095380515dcb8d1/lazr.delegates-%{version}.tar.gz
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
|
Patch0001: Test-using-zope.testrunner-rather-than-nose.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The lazr.delegates package makes it easy to write objects that delegate
|
The lazr.delegates package makes it easy to write objects that delegate
|
||||||
behavior to another object. The new object adds some property or behavior on
|
behavior to another object. The new object adds some property or behavior on
|
||||||
@ -34,7 +36,7 @@ Provides: python3-lazr.delegates-doc
|
|||||||
Development documents and examples for lazr.delegates.
|
Development documents and examples for lazr.delegates.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n lazr.delegates-%{version}
|
%autosetup -n lazr.delegates-%{version} -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%py3_build
|
%py3_build
|
||||||
@ -74,5 +76,9 @@ mv %{buildroot}/doclist.lst .
|
|||||||
%{_pkgdocdir}
|
%{_pkgdocdir}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu Dec 17 2020 Python_Bot <Python_Bot@openeuler.org>
|
* Fri Jan 07 2022 Chen Chen <chen_aka_jan@163.com> - 2.0.4-2
|
||||||
|
- using zope.testrunner instead of nose
|
||||||
|
- update python version
|
||||||
|
|
||||||
|
* Thu Dec 17 2020 Python_Bot <Python_Bot@openeuler.org> - 2.0.4-1
|
||||||
- Package Spec generated
|
- Package Spec generated
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user