From 5d449471b12c67b31ebb5a383d9bb35bace36213 Mon Sep 17 00:00:00 2001 From: Samuel Merritt Date: Thu, 14 Jan 2016 17:26:01 -0800 Subject: [PATCH] Remove some Python 2.6 leftovers Change-Id: I798d08722c90327c66759aa0bb4526851ba38d41 --- swift/common/ring/ring.py | 10 +--------- test/unit/common/ring/test_ring.py | 5 ----- test/unit/common/test_utils.py | 4 ---- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/swift/common/ring/ring.py b/swift/common/ring/ring.py index e00b0db3a9..2a42df9aeb 100644 --- a/swift/common/ring/ring.py +++ b/swift/common/ring/ring.py @@ -15,7 +15,6 @@ import array import six.moves.cPickle as pickle -import inspect import json from collections import defaultdict from gzip import GzipFile @@ -135,15 +134,8 @@ class RingData(object): # Override the timestamp so that the same ring data creates # the same bytes on disk. This makes a checksum comparison a # good way to see if two rings are identical. - # - # This only works on Python 2.7; on 2.6, we always get the - # current time in the gzip output. tempf = NamedTemporaryFile(dir=".", prefix=filename, delete=False) - if 'mtime' in inspect.getargspec(GzipFile.__init__).args: - gz_file = GzipFile(filename, mode='wb', fileobj=tempf, - mtime=mtime) - else: - gz_file = GzipFile(filename, mode='wb', fileobj=tempf) + gz_file = GzipFile(filename, mode='wb', fileobj=tempf, mtime=mtime) self.serialize_v1(gz_file) gz_file.close() tempf.flush() diff --git a/test/unit/common/ring/test_ring.py b/test/unit/common/ring/test_ring.py index a492b44bd4..3d29648603 100644 --- a/test/unit/common/ring/test_ring.py +++ b/test/unit/common/ring/test_ring.py @@ -16,7 +16,6 @@ import array import six.moves.cPickle as pickle import os -import sys import unittest import stat from contextlib import closing @@ -109,11 +108,7 @@ class TestRingData(unittest.TestCase): def test_deterministic_serialization(self): """ Two identical rings should produce identical .gz files on disk. - - Only true on Python 2.7 or greater. """ - if sys.version_info[0] == 2 and sys.version_info[1] < 7: - return os.mkdir(os.path.join(self.testdir, '1')) os.mkdir(os.path.join(self.testdir, '2')) # These have to have the same filename (not full path, diff --git a/test/unit/common/test_utils.py b/test/unit/common/test_utils.py index efefb5581e..8f5f82eff0 100644 --- a/test/unit/common/test_utils.py +++ b/test/unit/common/test_utils.py @@ -140,10 +140,6 @@ class MockSys(object): self.stdio_fds = [self.stdin.fileno(), self.stdout.fileno(), self.stderr.fileno()] - @property - def version_info(self): - return sys.version_info - def reset_loggers(): if hasattr(utils.get_logger, 'handler4logger'):