Imported Upstream version 2.1.0 upstream/2.1.0
authorJinWang An <jinwang.an@samsung.com>
Mon, 28 Dec 2020 04:45:06 +0000 (13:45 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 28 Dec 2020 04:45:06 +0000 (13:45 +0900)
13 files changed:
AUTHORS
ChangeLog
PKG-INFO
doc/source/index.rst
pbr.egg-info/PKG-INFO
pbr.egg-info/entry_points.txt
pbr/builddoc.py
pbr/testr_command.py
pbr/tests/test_setup.py
pbr/version.py
setup.cfg
test-requirements.txt
tox.ini

diff --git a/AUTHORS b/AUTHORS
index cc4b4ee33a63bd01506ab5e09c729006972a783f..d93725a95f1f96d15645d738e2bb5b5b4e2aecaa 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,6 +1,7 @@
 Akihiro Motoki <motoki@da.jp.nec.com>
 Alex Gaynor <alex.gaynor@gmail.com>
 Alexander Makarov <amakarov@mirantis.com>
+Alfredo Moralejo <amoralej@redhat.com>
 Andreas Jaeger <aj@suse.de>
 Andrew Bogott <abogott@wikimedia.org>
 Angus Salkeld <asalkeld@redhat.com>
index 9c3b41bcbdc14b6893806a751fd620c5a63df7a0..2218ced07d3c38e00e5889e77dd8792aed1af3cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,22 @@
 CHANGES
 =======
 
+2.1.0
+-----
+
+* Lazy import pkg_resources
+* Initialize sphinx config using application instead of config
+* Updated from global requirements
+* Also generate XML coverage report
+* Update to a newer hacking library
+
 2.0.0
 -----
 
 * tox: Don't set skipsdist=True
 * Stop using 'warnerrors'
 * doc: Clarify sections in 'setup.cfg'
+* Remove testr entry point
 * Updated from global requirements
 * Remove discover from test-requirements
 * Add Constraints support
index 37503ca625a15b471fb5fc4ae232bc4a5e040c5c..3b4f8eb3e421111189ab2871c3de6a11c0da1594 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pbr
-Version: 2.0.0
+Version: 2.1.0
 Summary: Python Build Reasonableness
 Home-page: http://docs.openstack.org/developer/pbr/
 Author: OpenStack
index a2b4342ee51683f0a0cc3cbb5d875ff10224b7be..4c80aa696624832621b93183a9ca8fea58661abd 100644 (file)
@@ -390,6 +390,53 @@ environment, you can use::
     testing =
         quux:python_version=='2.7'
 
+
+Testing
+-------
+
+pbr overrides the ``setuptools`` hook ``test`` (i.e. ``setup.py
+test``).  The following sequence is followed:
+
+#. If a ``.testr.conf`` file exists and `testrepository
+   <https://pypi.python.org/pypi/testrepository>`__ is installed, PBR
+   will use it as the test runner.  See the ``testr`` documentation
+   for more details.
+
+   .. note::
+
+     This is separate to ``setup.py testr`` (note the extra ``r``) which
+     is provided directly by the ``testrepository`` package.  Be careful
+     as there is some overlap of command arguments.
+
+#. Although deprecated, if ``[nosetests]`` is defined in ``setup.cfg``
+   and `nose <http://nose.readthedocs.io/en/latest/>`__ is installed,
+   the ``nose`` runner will be used.
+
+#. In other cases no override will be installed and the ``test``
+   command will revert to `setuptools
+   <http://setuptools.readthedocs.io/en/latest/setuptools.html#test-build-package-and-run-a-unittest-suite>`__.
+
+A typical usage would be in ``tox.ini`` such as::
+
+  [tox]
+  minversion = 2.0
+  skipsdist = True
+  envlist = py33,py34,py35,py26,py27,pypy,pep8,docs
+
+  [testenv]
+  usedevelop = True
+  setenv =
+    VIRTUAL_ENV={envdir}
+    CLIENT_NAME=pbr
+  deps = .
+       -r{toxinidir}/test-requirements.txt
+  commands =
+    python setup.py test --testr-args='{posargs}'
+
+The argument ``--coverage`` will set ``PYTHON`` to ``coverage run`` to
+produce a coverage report.  ``--coverage-package-name`` can be used to
+modify or narrow the packages traced.
+
 Additional Docs
 ===============
 
index 37503ca625a15b471fb5fc4ae232bc4a5e040c5c..3b4f8eb3e421111189ab2871c3de6a11c0da1594 100644 (file)
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pbr
-Version: 2.0.0
+Version: 2.1.0
 Summary: Python Build Reasonableness
 Home-page: http://docs.openstack.org/developer/pbr/
 Author: OpenStack
index 71832ff2a6bb015c23867c9210361766eafd4fb5..ba19578453a8156e13886d0734a611b86d54b131 100644 (file)
@@ -1,9 +1,6 @@
 [console_scripts]
 pbr = pbr.cmd.main:main
 
-[distutils.commands]
-testr = pbr.testr_command:Testr
-
 [distutils.setup_keywords]
 pbr = pbr.core:pbr
 
index f51b283cbc258798908894e2be9956dc68a75428..4f0567377fe65482429f9cb1ad1bc6274fa6a04d 100644 (file)
@@ -17,9 +17,7 @@
 from distutils import log
 import fnmatch
 import os
-import pkg_resources
 import sys
-import warnings
 
 try:
     import cStringIO
@@ -29,7 +27,6 @@ except ImportError:
 try:
     from sphinx import apidoc
     from sphinx import application
-    from sphinx import config
     from sphinx import setup_command
 except Exception as e:
     # NOTE(dhellmann): During the installation of docutils, setuptools
@@ -134,16 +131,6 @@ class LocalBuildDoc(setup_command.BuildDoc):
             confoverrides['release'] = self.release
         if self.today:
             confoverrides['today'] = self.today
-        sphinx_config = config.Config(self.config_dir, 'conf.py', {}, [])
-        sphinx_ver = pkg_resources.parse_version(
-            pkg_resources.get_distribution("sphinx").version)
-        if sphinx_ver > pkg_resources.parse_version('1.2.3'):
-            sphinx_config.init_values(warnings.warn)
-        else:
-            sphinx_config.init_values()
-        if self.builder == 'man' and len(
-                getattr(sphinx_config, 'man_pages', '')) == 0:
-            return
         if self.sphinx_initialized:
             confoverrides['suppress_warnings'] = [
                 'app.add_directive', 'app.add_role',
@@ -153,6 +140,10 @@ class LocalBuildDoc(setup_command.BuildDoc):
             self.builder_target_dir, self.doctree_dir,
             self.builder, confoverrides, status_stream,
             freshenv=self.fresh_env, warningiserror=self.warning_is_error)
+        sphinx_config = app.config
+        if self.builder == 'man' and len(
+                getattr(sphinx_config, 'man_pages', '')) == 0:
+            return
         self.sphinx_initialized = True
 
         try:
index 2598a0b6d657f0f311c17f0630d5f796640fb807..cd179a27a65bd691bf763ffa536ed4244cd095b9 100644 (file)
 # license you chose for the specific language governing permissions and
 # limitations under that license.
 
-"""setuptools/distutils commands to run testr via setup.py
+"""setuptools/distutils command to run testr via setup.py
 
-Currently provides 'testr' which runs tests using testr. You can pass
---coverage which will also export PYTHON='coverage run --source <your package>'
-and automatically combine the coverage from each testr backend test runner
-after the run completes.
+PBR will hook in the Testr class to provide "setup.py test" when
+.testr.conf is present in the repository (see pbr/hooks/commands.py).
+
+If we are activated but testrepository is not installed, we provide a
+sensible error.
+
+You can pass --coverage which will also export PYTHON='coverage run
+--source <your package>' and automatically combine the coverage from
+each testr backend test runner after the run completes.
 
-To use, just use setuptools/distribute and depend on testr, and it should be
-picked up automatically (as the commands are exported in the testrepository
-package metadata.
 """
 
 from distutils import cmd
@@ -133,6 +135,7 @@ class TestrReal(cmd.Command):
         logger.debug("_coverage_after called")
         os.system("coverage combine")
         os.system("coverage html -d ./cover %s" % self.omit)
+        os.system("coverage xml -o ./cover/coverage.xml %s" % self.omit)
 
 
 class TestrFake(cmd.Command):
index 0754a8d1bd73058498b1c5680a8933a9efed3a80..0930e3508522191c4241ef43676a8da069efc124 100644 (file)
@@ -224,6 +224,10 @@ class GitLogsTest(base.BaseTestCase):
             self.assertTrue(co_author in authors)
 
 
+class _SphinxConfig(object):
+    man_pages = ['foo']
+
+
 class BaseSphinxTest(base.BaseTestCase):
 
     def setUp(self):
@@ -234,7 +238,7 @@ class BaseSphinxTest(base.BaseTestCase):
         self.useFixture(fixtures.MonkeyPatch(
             "sphinx.application.Sphinx.build", lambda *a, **kw: None))
         self.useFixture(fixtures.MonkeyPatch(
-            "sphinx.config.Config.man_pages", ['foo']))
+            "sphinx.application.Sphinx.config", _SphinxConfig))
         self.useFixture(fixtures.MonkeyPatch(
             "sphinx.config.Config.init_values", lambda *a: None))
         self.useFixture(fixtures.MonkeyPatch(
index e775267548890b7906a762870af7b4e6511f5058..474faf16a0db64d7fa3e8885d627956f62592506 100644 (file)
@@ -22,8 +22,6 @@ import itertools
 import operator
 import sys
 
-import pkg_resources
-
 
 def _is_int(string):
     try:
@@ -435,6 +433,9 @@ class VersionInfo(object):
         record associated with the package, and if there is no such record
         falls back to the logic sdist would use.
         """
+        # Lazy import because pkg_resources is costly to import so defer until
+        # we absolutely need it.
+        import pkg_resources
         try:
             requirement = pkg_resources.Requirement.parse(self.package)
             provider = pkg_resources.get_provider(requirement)
index ed6ec280abe6b5165b1b22b1d4f24a414a226fd9..899e5f3ba04e5906312877228c5730d70ed16ab2 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -41,8 +41,6 @@ autodoc_tree_excludes =
 [entry_points]
 distutils.setup_keywords = 
        pbr = pbr.core:pbr
-distutils.commands = 
-       testr = pbr.testr_command:Testr
 egg_info.writers = 
        pbr.json = pbr.pbr_json:write_pbr_json
 console_scripts = 
index 221e36fc0fc8f2fc58306ecca2efc804332d0477..9af272838450d4d1913edfcfa1589e786762f683 100644 (file)
@@ -3,7 +3,7 @@
 # process, which may cause wedges in the gate later.
 coverage>=4.0 # Apache-2.0
 fixtures>=3.0.0 # Apache-2.0/BSD
-hacking<0.11,>=0.10.0
+hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
 mock>=2.0 # BSD
 python-subunit>=0.0.18 # Apache-2.0/BSD
 sphinx>=1.5.1 # BSD
diff --git a/tox.ini b/tox.ini
index a288adf7b170fbb1e7603ca11d1c9bb379a8ac31..823a8e869a4836f7f69e9a060a870fddc87df627 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -11,7 +11,7 @@ setenv =
     CLIENT_NAME=pbr
 deps = -r{toxinidir}/test-requirements.txt
 commands =
-  python setup.py testr --testr-args='{posargs}'
+  python setup.py test --testr-args='{posargs}'
 
 [tox:jenkins]
 sitepackages = True
@@ -24,7 +24,7 @@ commands = python setup.py build_sphinx
 
 [testenv:cover]
 commands =
-  python setup.py testr --coverage
+  python setup.py test --coverage
 
 [testenv:venv]
 commands = {posargs}