diff --git a/pbr/tests/__init__.py b/pbr/tests/__init__.py index 0dfd2e1..4814cfa 100644 --- a/pbr/tests/__init__.py +++ b/pbr/tests/__init__.py @@ -23,7 +23,6 @@ import testresources import testtools from pbr import packaging -from pbr.tests import moxstubout class BaseTestCase(testtools.TestCase, testresources.ResourcedTestCase): @@ -52,4 +51,3 @@ class BaseTestCase(testtools.TestCase, testresources.ResourcedTestCase): self.useFixture(fixtures.NestedTempfile()) self.useFixture(fixtures.FakeLogger()) - self.stubs = self.useFixture(moxstubout.MoxStubout()).stubs diff --git a/pbr/tests/test_version.py b/pbr/tests/test_version.py index 2fae9a5..bd72a2d 100644 --- a/pbr/tests/test_version.py +++ b/pbr/tests/test_version.py @@ -15,21 +15,12 @@ # License for the specific language governing permissions and limitations # under the License. -import sys - -from d2to1.extern import six -from oslo.config import cfg - from pbr import tests from pbr import version class DeferredVersionTestCase(tests.BaseTestCase): - def setUp(self): - super(DeferredVersionTestCase, self).setUp() - self.conf = cfg.ConfigOpts() - def test_cached_version(self): class MyVersionInfo(version.VersionInfo): def _get_version_from_pkg_resources(self): @@ -37,39 +28,4 @@ class DeferredVersionTestCase(tests.BaseTestCase): deferred_string = MyVersionInfo("openstack").\ cached_version_string() - self.conf([], project="project", prog="prog", version=deferred_string) - self.assertEquals("5.5.5.5", str(self.conf.version)) - - def test_print_cached_version(self): - class MyVersionInfo(version.VersionInfo): - def _get_version_from_pkg_resources(self): - return "5.5.5.5" - - deferred_string = MyVersionInfo("openstack")\ - .cached_version_string() - self.stubs.Set(sys, 'stderr', six.StringIO()) - self.assertRaises(SystemExit, - self.conf, ['--version'], - project="project", - prog="prog", - version=deferred_string) - self.assertEquals("5.5.5.5", sys.stderr.getvalue().strip()) - - def test_print_cached_version_with_long_string(self): - my_version = "11111222223333344444555556666677777888889999900000" - - class MyVersionInfo(version.VersionInfo): - def _get_version_from_pkg_resources(self): - return my_version - - deferred_string = MyVersionInfo("openstack")\ - .cached_version_string() - - for i in range(50): - self.stubs.Set(sys, 'stderr', six.StringIO()) - self.assertRaises(SystemExit, - self.conf, ['--version'], - project="project", - prog="prog", - version=deferred_string) - self.assertEquals(my_version, sys.stderr.getvalue().strip()) + self.assertEquals("5.5.5.5", deferred_string)