Skip to content

Commit

Permalink
Fix deprecation warning from Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Jun 23, 2022
1 parent 5df9c90 commit 89812a4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/nginx_opentracing_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,22 @@
import grpc
import app_pb2 as app_messages
import app_pb2_grpc as app_service
import warnings

def get_docker_client():
with warnings.catch_warnings():
# Silence warnings due to use of deprecated methods within dockerpy
# See https://github.com/docker/docker-py/pull/2931
warnings.filterwarnings(
"ignore",
message="distutils Version classes are deprecated.*",
category=DeprecationWarning,
)

return docker.from_env()

class NginxOpenTracingTest(unittest.TestCase):

def setUp(self):
self.testdir = os.getcwd()
self.workdir = os.path.join(tempfile.mkdtemp(), "environment")
Expand All @@ -27,7 +41,7 @@ def setUp(self):
self.environment_handle = subprocess.Popen(["docker-compose", "up"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
self.client = docker.from_env()
self.client = get_docker_client()
timeout = time.time() + 60
while len(self.client.containers.list()) != 4:
if time.time() > timeout:
Expand Down

0 comments on commit 89812a4

Please sign in to comment.