From 26f4030438a06769af85ec5ff9fdcbc675dd4bb5 Mon Sep 17 00:00:00 2001 From: "Gavin M. Roy" Date: Tue, 14 Jun 2016 12:26:54 -0400 Subject: [PATCH] Skip the ConnectionError test in Python 2.7 --- tests/api_tests.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/api_tests.py b/tests/api_tests.py index 4a5fb9a..1a90c8f 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -1,7 +1,9 @@ import datetime import os import socket +import sys import uuid +import unittest import mock @@ -11,14 +13,7 @@ from tornado import testing from tornado_aws import exceptions as aws_exceptions from sprockets.clients import dynamodb -from sprockets.clients.dynamodb import exceptions - -# Stub ConnectionError for Python 2.7 that doesn't support it -try: - ConnectionError -except NameError: - class ConnectionError(Exception): - pass +from sprockets.clients.dynamodb import connector, exceptions class AsyncTestCase(testing.AsyncTestCase): @@ -118,7 +113,8 @@ class AWSClientTests(AsyncTestCase): with self.assertRaises(exceptions.RequestException): yield self.client.create_table(self.generic_table_definition()) - + @unittest.skipIf(sys.version_info.major < 3, + 'ConnectionError is Python3 only') @testing.gen_test def test_connection_error_request_exception(self): with mock.patch('tornado_aws.client.AsyncAWSClient.fetch') as fetch: