Merge "Remove some Python 2.6 leftovers"

This commit is contained in:
Jenkins 2016-01-15 23:34:42 +00:00 committed by Gerrit Code Review
commit f138535854
3 changed files with 1 additions and 18 deletions

View File

@ -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()

View File

@ -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,

View File

@ -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'):