From c4c0741832f89aae7f5ef3785b000ed40e1e78be Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Thu, 17 Sep 2020 15:10:23 +0000 Subject: [PATCH] test: use sys.path to add manager --- iot/api-client/http_example/cloudiot_http_example_test.py | 3 ++- iot/api-client/mqtt_example/cloudiot_mqtt_example_test.py | 3 ++- iot/api-client/mqtt_example/cloudiot_mqtt_image_test.py | 3 ++- iot/api-client/mqtt_example/fixtures.py | 3 ++- iot/api-client/mqtt_example/gateway_demo.py | 4 +++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/iot/api-client/http_example/cloudiot_http_example_test.py b/iot/api-client/http_example/cloudiot_http_example_test.py index fc9f7de83566..35a1eb565274 100644 --- a/iot/api-client/http_example/cloudiot_http_example_test.py +++ b/iot/api-client/http_example/cloudiot_http_example_test.py @@ -22,7 +22,8 @@ import cloudiot_http_example # Add manager for bootstrapping device registry / device for testing -from .. import manager +sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa +import manager # noqa cloud_region = 'us-central1' diff --git a/iot/api-client/mqtt_example/cloudiot_mqtt_example_test.py b/iot/api-client/mqtt_example/cloudiot_mqtt_example_test.py index 952bb119cc7c..7b42574287ff 100644 --- a/iot/api-client/mqtt_example/cloudiot_mqtt_example_test.py +++ b/iot/api-client/mqtt_example/cloudiot_mqtt_example_test.py @@ -23,8 +23,9 @@ from fixtures import test_device_id # noqa from fixtures import device_and_gateways # noqa # Add manager for bootstrapping device registry / device for testing -from .. import manager +sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa import cloudiot_mqtt_example # noqa +import manager # noqa cloud_region = 'us-central1' diff --git a/iot/api-client/mqtt_example/cloudiot_mqtt_image_test.py b/iot/api-client/mqtt_example/cloudiot_mqtt_image_test.py index cd10c140f5d0..cb68108e402d 100644 --- a/iot/api-client/mqtt_example/cloudiot_mqtt_image_test.py +++ b/iot/api-client/mqtt_example/cloudiot_mqtt_image_test.py @@ -17,8 +17,9 @@ import tempfile # Add manager as library +sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa import cloudiot_mqtt_image # noqa -from .. import manager +import manager # noqa from fixtures import test_topic # noqa from fixtures import test_subscription # noqa from fixtures import test_registry_id # noqa diff --git a/iot/api-client/mqtt_example/fixtures.py b/iot/api-client/mqtt_example/fixtures.py index 1c557d1aa6aa..3f7646a8a611 100644 --- a/iot/api-client/mqtt_example/fixtures.py +++ b/iot/api-client/mqtt_example/fixtures.py @@ -25,7 +25,8 @@ import pytest # Add manager as library -from .. import manager +sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa +import manager # noqa cloud_region = 'us-central1' diff --git a/iot/api-client/mqtt_example/gateway_demo.py b/iot/api-client/mqtt_example/gateway_demo.py index 60e8d92fa4d9..b8914d739ddb 100644 --- a/iot/api-client/mqtt_example/gateway_demo.py +++ b/iot/api-client/mqtt_example/gateway_demo.py @@ -20,8 +20,10 @@ import sys import time +sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'manager')) # noqa import cloudiot_mqtt_example # noqa -from .. import manager +import manager # noqa + logging.getLogger('googleapiclient.discovery_cache').setLevel(logging.CRITICAL)