Skip to content

Commit ab87ac3

Browse files
committed
refactor(tests): Remove superfluous imports
Signed-off-by: Varsha GS <[email protected]>
1 parent 5c7262e commit ab87ac3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+35
-122
lines changed

example/asyncio/aioclient.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2019
33

4-
from __future__ import absolute_import
5-
64
import aiohttp
75
import asyncio
86

tests/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2017
33

4-
from __future__ import absolute_import
54
import os
65

76
os.environ["INSTANA_TEST"] = "true"

tests/apps/grpc_server/stan_client.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2019
33

4-
from __future__ import absolute_import
5-
64
import time
75
import random
86

tests/clients/boto3/test_boto3_lambda.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
54
import unittest
65
import json
76

tests/clients/boto3/test_boto3_s3.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
54
import os
65
import unittest
76

tests/clients/boto3/test_boto3_secretsmanager.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import os
75
import boto3
86
import unittest

tests/clients/boto3/test_boto3_ses.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import os
75
import boto3
86
import unittest

tests/clients/boto3/test_boto3_sqs.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import os
75
import boto3
86
import unittest

tests/clients/test_cassandra-driver.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import os
75
import time
8-
import pytest
96
import random
107
import unittest
118

@@ -31,7 +28,7 @@
3128
");")
3229

3330

34-
@pytest.mark.skipif(not os.environ.get("CASSANDRA_TEST"), reason="")
31+
@unittest.mark.skipif(not os.environ.get("CASSANDRA_TEST"), reason="")
3532
class TestCassandra(unittest.TestCase):
3633
def setUp(self):
3734
""" Clear all spans before a test run """

tests/clients/test_couchbase.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import os
75
import time
8-
import pytest
96
import unittest
107

118
from instana.singletons import tracer
@@ -29,7 +26,7 @@
2926
pass
3027

3128

32-
@pytest.mark.skipif(not os.environ.get("COUCHBASE_TEST"), reason="")
29+
@unittest.mark.skipif(not os.environ.get("COUCHBASE_TEST"), reason="")
3330
class TestStandardCouchDB(unittest.TestCase):
3431
def setup_class(self):
3532
""" Clear all spans before a test run """

tests/clients/test_google-cloud-pubsub.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2021
33

4-
from __future__ import absolute_import
5-
64
import os
7-
import sys
85
import threading
96
import time
10-
import pytest
11-
127
import six
138
import unittest
149

tests/clients/test_google-cloud-storage.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import sys
75
import unittest
8-
import pytest
96
import json
107
import requests
118
import io
@@ -24,7 +21,7 @@ def setUp(self):
2421
self.recorder = tracer.recorder
2522
self.recorder.clear_spans()
2623

27-
@pytest.mark.skipif(sys.platform == "darwin", reason="Raises not Implemented exception in OSX")
24+
@unittest.mark.skipif(sys.platform == "darwin", reason="Raises not Implemented exception in OSX")
2825
@patch('requests.Session.request')
2926
def test_buckets_list(self, mock_requests):
3027
mock_requests.return_value = self._mock_response(
@@ -513,7 +510,7 @@ def test_objects_insert(self, mock_requests):
513510
self.assertEqual('test bucket', gcs_span.data["gcs"]["bucket"])
514511
self.assertEqual('test object', gcs_span.data["gcs"]["object"])
515512

516-
@pytest.mark.skipif(sys.platform == "darwin", reason="Raises not Implemented exception in OSX")
513+
@unittest.mark.skipif(sys.platform == "darwin", reason="Raises not Implemented exception in OSX")
517514
@patch('requests.Session.request')
518515
def test_objects_list(self, mock_requests):
519516
mock_requests.return_value = self._mock_response(
@@ -787,7 +784,7 @@ def test_object_hmac_keys_get(self, mock_requests):
787784
self.assertEqual('test-project', gcs_span.data["gcs"]["projectId"])
788785
self.assertEqual('test key', gcs_span.data["gcs"]["accessId"])
789786

790-
@pytest.mark.skipif(sys.platform == "darwin", reason="Raises not Implemented exception in OSX")
787+
@unittest.mark.skipif(sys.platform == "darwin", reason="Raises not Implemented exception in OSX")
791788
@patch('requests.Session.request')
792789
def test_object_hmac_keys_list(self, mock_requests):
793790
mock_requests.return_value = self._mock_response(

tests/clients/test_logging.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import logging
75
import unittest
86
from instana.singletons import tracer

tests/clients/test_mysqlclient.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
6-
import sys
74
import logging
85
import unittest
6+
97
import MySQLdb
8+
109
from ..helpers import testenv
11-
from unittest import SkipTest
1210
from instana.singletons import tracer
1311

1412
logger = logging.getLogger(__name__)

tests/clients/test_pika.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2021
33

4-
from __future__ import absolute_import
5-
6-
import pika
74
import unittest
8-
import mock
95
import threading
106
import time
117

8+
import pika
9+
import mock
10+
1211
from instana.singletons import tracer
1312

1413

tests/clients/test_psycopg2.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import logging
75
import unittest
6+
87
from ..helpers import testenv
98
from instana.singletons import tracer
109

tests/clients/test_pymongo.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import json
75
import unittest
86
import logging
9-
import pytest
107

118
from ..helpers import testenv
129
from instana.singletons import tracer
@@ -16,7 +13,7 @@
1613

1714
logger = logging.getLogger(__name__)
1815

19-
pymongoversion = pytest.mark.skipif(
16+
pymongoversion = unittest.mark.skipif(
2017
pymongo.version_tuple >= (4, 0), reason="map reduce is removed in pymongo 4.0"
2118
)
2219

tests/clients/test_pymysql.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
6-
import sys
74
import logging
85
import unittest
6+
97
import pymysql
8+
109
from ..helpers import testenv
1110
from instana.singletons import tracer
1211

tests/clients/test_redis.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import unittest
75

86
import redis
9-
from ..helpers import testenv
107
from redis.sentinel import Sentinel
8+
9+
from ..helpers import testenv
1110
from instana.singletons import tracer
1211

1312

tests/clients/test_sqlalchemy.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import unittest
75

86
from ..helpers import testenv
97
from instana.singletons import tracer
8+
109
from sqlalchemy.orm import sessionmaker
1110
from sqlalchemy.exc import OperationalError
1211
from sqlalchemy.orm import declarative_base

tests/clients/test_urllib3.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
54
from multiprocessing.pool import ThreadPool
65
from time import sleep
76
import unittest

tests/frameworks/test_aiohttp_client.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import aiohttp
75
import asyncio
86
import unittest

tests/frameworks/test_aiohttp_server.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import aiohttp
75
import asyncio
86
import unittest

tests/frameworks/test_asyncio.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import asyncio
75
import aiohttp
86
import unittest

tests/frameworks/test_celery.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import time
5+
76
from celery import shared_task
7+
88
from instana.singletons import tracer
99
from ..helpers import get_first_span_by_filter
1010

tests/frameworks/test_django.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
54
import os
65

76
import urllib3

tests/frameworks/test_fastapi.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
54
import time
65
import unittest
76
import multiprocessing

tests/frameworks/test_flask.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import sys
75
import unittest
86
import urllib3

tests/frameworks/test_gevent.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import os
7-
import pytest
5+
import unittest
6+
87
import gevent
98
from gevent.pool import Group
109
import urllib3
11-
import unittest
10+
from opentracing.scope_managers.gevent import GeventScopeManager
1211

1312
import tests.apps.flask_app
1413
from instana.span import SDKSpan
1514
from instana.singletons import tracer
1615
from ..helpers import testenv, get_spans_by_filter
17-
from opentracing.scope_managers.gevent import GeventScopeManager
1816

1917

20-
@pytest.mark.skipif(not os.environ.get("GEVENT_TEST"), reason="")
18+
@unittest.mark.skipif(not os.environ.get("GEVENT_TEST"), reason="")
2119
class TestGEvent(unittest.TestCase):
2220
def setUp(self):
2321
self.http = urllib3.HTTPConnectionPool('127.0.0.1', port=testenv["wsgi_port"], maxsize=20)

tests/frameworks/test_grpcio.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. 2020
33

4-
from __future__ import absolute_import
5-
64
import time
75
import unittest
86
import random

0 commit comments

Comments
 (0)