From 3d10e09ccdf68d4118d4e04eb73a46e2f3703350 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Tue, 19 Mar 2013 18:33:08 -0700 Subject: [PATCH] Make hacking compliant. Change-Id: Ibbd091decfe377a43f691aaf26905edb40ff299f --- pbr/packaging.py | 3 ++- pbr/tests/test_setup.py | 17 ++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/pbr/packaging.py b/pbr/packaging.py index a4df6ad..4af5c9c 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -302,7 +302,8 @@ def _get_revno(git_dir): def _get_version_from_git(pre_version): """Return a version which is equal to the tag that's on the current revision if there is one, or tag plus number of additional revisions - if the current revision has no tag.""" + if the current revision has no tag. + """ git_dir = _get_git_directory() if git_dir: diff --git a/pbr/tests/test_setup.py b/pbr/tests/test_setup.py index eb74fb2..39f4776 100644 --- a/pbr/tests/test_setup.py +++ b/pbr/tests/test_setup.py @@ -18,9 +18,9 @@ import io import os -import sys import StringIO -from tempfile import mkstemp +import sys +import tempfile import fixtures @@ -57,7 +57,8 @@ class MailmapTestCase(utils.BaseTestCase): def setUp(self): super(MailmapTestCase, self).setUp() - (fd, self.mailmap) = mkstemp(prefix='openstack', suffix='.setup') + (fd, self.mailmap) = tempfile.mkstemp(prefix='openstack', + suffix='.setup') def test_mailmap_with_fullname(self): with open(self.mailmap, 'w') as mm_fh: @@ -159,8 +160,8 @@ class BuildSphinxTest(utils.BaseTestCase): self.useFixture(fixtures.MonkeyPatch( "sphinx.setup_command.BuildDoc.run", lambda self: None)) - from distutils.dist import Distribution - distr = Distribution() + from distutils import dist + distr = dist.Distribution() distr.packages = ("fake_package",) distr.command_options["build_sphinx"] = {"source_dir": ["a", "."]} pkg_fixture = fixtures.PythonPackage( @@ -181,7 +182,8 @@ class ParseRequirementsTest(utils.BaseTestCase): def setUp(self): super(ParseRequirementsTest, self).setUp() - (fd, self.tmp_file) = mkstemp(prefix='openstack', suffix='.setup') + (fd, self.tmp_file) = tempfile.mkstemp(prefix='openstack', + suffix='.setup') def test_parse_requirements_normal(self): with open(self.tmp_file, 'w') as fh: @@ -221,7 +223,8 @@ class ParseDependencyLinksTest(utils.BaseTestCase): def setUp(self): super(ParseDependencyLinksTest, self).setUp() - (fd, self.tmp_file) = mkstemp(prefix="openstack", suffix=".setup") + (fd, self.tmp_file) = tempfile.mkstemp(prefix="openstack", + suffix=".setup") def test_parse_dependency_normal(self): with open(self.tmp_file, "w") as fh: