From ab9994148b9990ca1be4d3e74141e1c13dc069dc Mon Sep 17 00:00:00 2001 From: Nicholas Muesch Date: Fri, 18 Jan 2019 10:49:42 -0500 Subject: [PATCH] Support Python 3 (#2964) --- tcp_check/datadog_checks/tcp_check/tcp_check.py | 8 +++----- tcp_check/setup.py | 2 +- tcp_check/tox.ini | 4 +--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tcp_check/datadog_checks/tcp_check/tcp_check.py b/tcp_check/datadog_checks/tcp_check/tcp_check.py index b6eb131762ede..4d34bbc5f7269 100644 --- a/tcp_check/datadog_checks/tcp_check/tcp_check.py +++ b/tcp_check/datadog_checks/tcp_check/tcp_check.py @@ -1,13 +1,11 @@ # (C) Datadog, Inc. 2010-2017 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) - -# stdlib import socket import time -# project -from datadog_checks.checks import NetworkCheck, Status +from datadog_checks.base import ensure_unicode +from datadog_checks.base.checks import NetworkCheck, Status class BadConfException(Exception): @@ -106,7 +104,7 @@ def _check(self, instance): return Status.UP, "UP" def report_as_service_check(self, sc_name, status, instance, msg=None): - instance_name = self.normalize(instance['name']) + instance_name = ensure_unicode(self.normalize(instance['name'])) host = instance.get('host', None) port = instance.get('port', None) custom_tags = instance.get('tags', []) diff --git a/tcp_check/setup.py b/tcp_check/setup.py index 6d7a16ee11394..bfd4b80636b1f 100644 --- a/tcp_check/setup.py +++ b/tcp_check/setup.py @@ -23,7 +23,7 @@ def get_requirements(fpath): return f.readlines() -CHECKS_BASE_REQ = 'datadog_checks_base' +CHECKS_BASE_REQ = 'datadog_checks_base>=4.2.0' setup( name='datadog-tcp_check', diff --git a/tcp_check/tox.ini b/tcp_check/tox.ini index 3005a1ba47ad7..2cf1ff7e97da5 100644 --- a/tcp_check/tox.ini +++ b/tcp_check/tox.ini @@ -2,14 +2,12 @@ minversion = 2.0 basepython = py27 envlist = - unit + {py27,py36}-unit flake8 [testenv] usedevelop = true platform = linux2|darwin|windows - -[testenv:unit] deps = -e../datadog_checks_base[deps] -rrequirements-dev.txt