Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for EOL Python versions #265

Merged
merged 6 commits into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unittest2 dependency
  • Loading branch information
hugovk committed Apr 19, 2019
commit d65205717700fe88fe4df7ee86b623833dc71288
8 changes: 4 additions & 4 deletions apitools/base/protorpclite/descriptor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"""Tests for apitools.base.protorpclite.descriptor."""
import platform
import types
import unittest

import six
import unittest2

from apitools.base.protorpclite import descriptor
from apitools.base.protorpclite import message_types
Expand Down Expand Up @@ -78,8 +78,8 @@ class NestedEnum(messages.Enum):
described.check_initialized()
self.assertEquals(expected, described)

@unittest2.skipIf('PyPy' in platform.python_implementation(),
'todo: reenable this')
@unittest.skipIf('PyPy' in platform.python_implementation(),
'todo: reenable this')
def testEnumWithItems(self):
class EnumWithItems(messages.Enum):
A = 3
Expand Down Expand Up @@ -512,4 +512,4 @@ def testNoPackage(self):


if __name__ == '__main__':
unittest2.main()
unittest.main()
2 changes: 1 addition & 1 deletion apitools/base/protorpclite/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
import re
import socket
import types
import unittest

import six
from six.moves import range # pylint: disable=redefined-builtin
import unittest2 as unittest

from apitools.base.protorpclite import message_types
from apitools.base.protorpclite import messages
Expand Down
6 changes: 3 additions & 3 deletions apitools/base/py/base_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import datetime
import sys
import contextlib
import unittest

import six
from six.moves import http_client
from six.moves import urllib_parse
import unittest2

from apitools.base.protorpclite import message_types
from apitools.base.protorpclite import messages
Expand Down Expand Up @@ -96,7 +96,7 @@ def __init__(self, client=None):
super(FakeService, self).__init__(client)


class BaseApiTest(unittest2.TestCase):
class BaseApiTest(unittest.TestCase):

def __GetFakeClient(self):
return FakeClient('', credentials=FakeCredentials())
Expand Down Expand Up @@ -331,4 +331,4 @@ def testColonInRelativePath(self):


if __name__ == '__main__':
unittest2.main()
unittest.main()
4 changes: 2 additions & 2 deletions apitools/base/py/batch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"""Tests for apitools.base.py.batch."""

import textwrap
import unittest

import mock
from six.moves import http_client
from six.moves import range # pylint:disable=redefined-builtin
from six.moves.urllib import parse
import unittest2

from apitools.base.py import batch
from apitools.base.py import exceptions
Expand Down Expand Up @@ -69,7 +69,7 @@ def ProcessHttpResponse(self, _, http_response):
return http_response


class BatchTest(unittest2.TestCase):
class BatchTest(unittest.TestCase):

def assertUrlEqual(self, expected_url, provided_url):

Expand Down
4 changes: 2 additions & 2 deletions apitools/base/py/buffered_stream_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
"""Tests for buffered_stream."""

import string
import unittest

import six
import unittest2

from apitools.base.py import buffered_stream
from apitools.base.py import exceptions


class BufferedStreamTest(unittest2.TestCase):
class BufferedStreamTest(unittest.TestCase):

def setUp(self):
self.stream = six.StringIO(string.ascii_letters)
Expand Down
7 changes: 4 additions & 3 deletions apitools/base/py/compression_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

"""Tests for compression."""

import unittest

from apitools.base.py import compression
from apitools.base.py import gzip

import six
import unittest2


class CompressionTest(unittest2.TestCase):
class CompressionTest(unittest.TestCase):

def setUp(self):
# Sample highly compressible data (~50MB).
Expand Down Expand Up @@ -98,7 +99,7 @@ def testCompressionIntegrity(self):
self.assertTrue(exhausted)


class StreamingBufferTest(unittest2.TestCase):
class StreamingBufferTest(unittest.TestCase):

def setUp(self):
self.stream = compression.StreamingBuffer()
Expand Down
6 changes: 3 additions & 3 deletions apitools/base/py/credentials_lib_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import os.path
import shutil
import tempfile
import unittest

import mock
import six
import unittest2

from apitools.base.py import credentials_lib
from apitools.base.py import util
Expand All @@ -43,7 +43,7 @@ def __call__(self, request_url):
self.fail('Unexpected HTTP request to %s' % request_url)


class CredentialsLibTest(unittest2.TestCase):
class CredentialsLibTest(unittest.TestCase):

def _RunGceAssertionCredentials(
self, service_account_name=None, scopes=None, cache_filename=None):
Expand Down Expand Up @@ -153,7 +153,7 @@ def testGetAdcNone(self):
self.assertIsNone(creds)


class TestGetRunFlowFlags(unittest2.TestCase):
class TestGetRunFlowFlags(unittest.TestCase):

def setUp(self):
self._flags_actual = credentials_lib.FLAGS
Expand Down
5 changes: 2 additions & 3 deletions apitools/base/py/encoding_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
import datetime
import json
import sys

import unittest2
import unittest

from apitools.base.protorpclite import message_types
from apitools.base.protorpclite import messages
Expand Down Expand Up @@ -238,7 +237,7 @@ class AdditionalProperty(messages.Message):
'repeated_field', 'repeatedField')


class EncodingTest(unittest2.TestCase):
class EncodingTest(unittest.TestCase):

def testCopyProtoMessage(self):
msg = SimpleMessage(field='abc')
Expand Down
4 changes: 2 additions & 2 deletions apitools/base/py/exceptions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest2
import unittest

from apitools.base.py import exceptions
from apitools.base.py import http_wrapper
Expand All @@ -24,7 +24,7 @@ def _MakeResponse(status_code):
request_url='http://www.google.com')


class HttpErrorFromResponseTest(unittest2.TestCase):
class HttpErrorFromResponseTest(unittest.TestCase):

"""Tests for exceptions.HttpError.FromResponse."""

Expand Down
5 changes: 2 additions & 3 deletions apitools/base/py/extra_types_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
import datetime
import json
import math

import unittest2
import unittest

from apitools.base.protorpclite import messages
from apitools.base.py import encoding
from apitools.base.py import exceptions
from apitools.base.py import extra_types


class ExtraTypesTest(unittest2.TestCase):
class ExtraTypesTest(unittest.TestCase):

def assertRoundTrip(self, value):
if isinstance(value, extra_types._JSON_PROTO_TYPES):
Expand Down
12 changes: 6 additions & 6 deletions apitools/base/py/http_wrapper_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

"""Tests for http_wrapper."""
import socket
import unittest

import httplib2
from six.moves import http_client
import unittest2

from mock import patch

Expand Down Expand Up @@ -57,16 +57,16 @@ def length(self):
return 1


class HttpWrapperTest(unittest2.TestCase):
class HttpWrapperTest(unittest.TestCase):

def testRequestBodyUsesLengthProperty(self):
http_wrapper.Request(body=RaisesExceptionOnLen())

def testRequestBodyWithLen(self):
http_wrapper.Request(body='burrito')

@unittest2.skipIf(not _TOKEN_REFRESH_STATUS_AVAILABLE,
'oauth2client<1.5 lacks HttpAccessTokenRefreshError.')
@unittest.skipIf(not _TOKEN_REFRESH_STATUS_AVAILABLE,
'oauth2client<1.5 lacks HttpAccessTokenRefreshError.')
def testExceptionHandlerHttpAccessTokenError(self):
exception_arg = HttpAccessTokenRefreshError(status=503)
retry_args = http_wrapper.ExceptionRetryArgs(
Expand All @@ -80,8 +80,8 @@ def testExceptionHandlerHttpAccessTokenError(self):
http_wrapper.HandleExceptionsAndRebuildHttpConnections(
retry_args)

@unittest2.skipIf(not _TOKEN_REFRESH_STATUS_AVAILABLE,
'oauth2client<1.5 lacks HttpAccessTokenRefreshError.')
@unittest.skipIf(not _TOKEN_REFRESH_STATUS_AVAILABLE,
'oauth2client<1.5 lacks HttpAccessTokenRefreshError.')
def testExceptionHandlerHttpAccessTokenErrorRaises(self):
exception_arg = HttpAccessTokenRefreshError(status=200)
retry_args = http_wrapper.ExceptionRetryArgs(
Expand Down
6 changes: 3 additions & 3 deletions apitools/base/py/list_pager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

"""Tests for list_pager."""

import unittest2
import unittest

from apitools.base.py import list_pager
from apitools.base.py.testing import mock
Expand All @@ -27,7 +27,7 @@
from samples.iam_sample.iam_v1 import iam_v1_messages as iam_messages


class ListPagerTest(unittest2.TestCase):
class ListPagerTest(unittest.TestCase):

def _AssertInstanceSequence(self, results, n):
counter = 0
Expand Down Expand Up @@ -243,7 +243,7 @@ def testYieldFromListWithPredicate(self):
self._AssertInstanceSequence(results, 3)


class ListPagerAttributeTest(unittest2.TestCase):
class ListPagerAttributeTest(unittest.TestCase):

def setUp(self):
self.mocked_client = mock.Client(iam_client.IamV1)
Expand Down
4 changes: 2 additions & 2 deletions apitools/base/py/stream_slice_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
"""Tests for stream_slice."""

import string
import unittest

import six
import unittest2

from apitools.base.py import exceptions
from apitools.base.py import stream_slice


class StreamSliceTest(unittest2.TestCase):
class StreamSliceTest(unittest.TestCase):

def setUp(self):
self.stream = six.StringIO(string.ascii_letters)
Expand Down
7 changes: 4 additions & 3 deletions apitools/base/py/testing/mock_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

"""Tests for apitools.base.py.testing.mock."""

import unittest

import httplib2
import unittest2
import six

from apitools.base.protorpclite import messages
Expand All @@ -42,7 +43,7 @@ class CustomException(Exception):
pass


class MockTest(unittest2.TestCase):
class MockTest(unittest.TestCase):

def testMockFusionBasic(self):
with mock.Client(fusiontables.FusiontablesV1) as client_class:
Expand Down Expand Up @@ -220,7 +221,7 @@ class _NestedNestedMessage(messages.Message):
nested = messages.MessageField(_NestedMessage, 1)


class UtilTest(unittest2.TestCase):
class UtilTest(unittest.TestCase):

def testMessagesEqual(self):
self.assertFalse(mock._MessagesEqual(
Expand Down
6 changes: 3 additions & 3 deletions apitools/base/py/transfer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

"""Tests for transfer.py."""
import string
import unittest

import httplib2
import mock
import six
from six.moves import http_client
import unittest2

from apitools.base.py import base_api
from apitools.base.py import exceptions
Expand All @@ -30,7 +30,7 @@
from apitools.base.py import transfer


class TransferTest(unittest2.TestCase):
class TransferTest(unittest.TestCase):

def assertRangeAndContentRangeCompatible(self, request, response):
request_prefix = 'bytes='
Expand Down Expand Up @@ -311,7 +311,7 @@ def testMultipartEncoding(self):
self.assertTrue(rewritten_upload_contents.endswith(upload_bytes))


class UploadTest(unittest2.TestCase):
class UploadTest(unittest.TestCase):

def setUp(self):
# Sample highly compressible data.
Expand Down
4 changes: 2 additions & 2 deletions apitools/base/py/util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

"""Tests for util.py."""
import unittest2
import unittest

from apitools.base.protorpclite import messages
from apitools.base.py import encoding
Expand Down Expand Up @@ -48,7 +48,7 @@ class AnEnum(messages.Enum):
MessageWithRemappings.AnEnum, 'value_one', 'ONE')


class UtilTest(unittest2.TestCase):
class UtilTest(unittest.TestCase):

def testExpand(self):
method_config_xy = MockedMethodConfig(relative_path='{x}/y/{z}',
Expand Down
Loading