Tests: Remove Python 2 compat file_spec code

We no longer need to support Python 2 unit tests.

Change-Id: I8cc31c2f2e61a13b98f4d7310f4333c48c263e44
This commit is contained in:
Eric Harney 2020-03-10 11:15:33 -04:00
parent c49442889c
commit 104813a3eb
1 changed files with 4 additions and 10 deletions

View File

@ -15,7 +15,6 @@
import datetime
import socket
import sys
from unittest import mock
import uuid
@ -443,7 +442,7 @@ file_spec = None
def get_file_spec():
"""Return a Python 2 and 3 compatible version of a 'file' spec.
"""Return a 'file' spec.
This is to be used anywhere that you need to do something such as
mock.MagicMock(spec=file) to mock out something with the file attributes.
@ -454,14 +453,9 @@ def get_file_spec():
global file_spec
# set on first use
if file_spec is None:
if sys.version_info[0] == 3:
import _io
file_spec = list(set(dir(_io.TextIOWrapper)).union(
set(dir(_io.BytesIO))))
else:
# NOTE(jsbryant): Pep8 on py3 based systems will fail because
# 'file' has been removed. Using noqa here to avoid the failure.
file_spec = file # noqa
import _io
file_spec = list(set(dir(_io.TextIOWrapper)).union(
set(dir(_io.BytesIO))))
def generate_timeout_series(timeout):