From addfd992a67912f145998c4eaabe955904e76bb0 Mon Sep 17 00:00:00 2001 From: Mariana Mihova <10135329+marianan@users.noreply.github.com> Date: Thu, 24 Sep 2020 04:28:42 +0000 Subject: [PATCH] Load config file using read_file as readfp is being deprecated (#437) * Load config file using read_file as read_fp is getting deprecated * The `read_file` method is not available on ConfigParser in py2.7, add a check * Update package version + add test debug config in launch.json --- .vscode/launch.json | 13 ++++++++++++- CHANGELOG.md | 4 ++++ iotedgedev/__init__.py | 2 +- iotedgedev/telemetryconfig.py | 7 ++++++- setup.cfg | 2 +- setup.py | 2 +- 6 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index d2519d09..e546b534 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,13 +1,24 @@ { "version": "0.2.0", "configurations": [ + { + "name": "Python: debug test", + "type": "python", + "request": "launch", + "module": "pytest", + "args": [ + "-v", + "${workspaceFolder}/tests/test_simulator.py::test_monitor" + ], + "cwd": "${workspaceFolder}" + }, { "name": "Python Module", "type": "python", "request": "launch", "module": "iotedgedev.cli", "args": [ - "push" + "init" ], "cwd": "${workspaceFolder}/tests/test_solution" } diff --git a/CHANGELOG.md b/CHANGELOG.md index a82f28aa..3aada19f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this project since 0.82.0 will be documented in this file. +## [2.1.6] - 2020-09-23 +### Changed +- Fix warning about ConfigParser readfp deprecation + ## [2.1.5] - 2020-08-18 ### Changed - Fix error caused by latest bcrypt on Azure Pipelines agent diff --git a/iotedgedev/__init__.py b/iotedgedev/__init__.py index aa40146c..8eab2f32 100644 --- a/iotedgedev/__init__.py +++ b/iotedgedev/__init__.py @@ -4,5 +4,5 @@ __author__ = 'Microsoft Corporation' __email__ = 'vsciet@microsoft.com' -__version__ = '2.1.5' +__version__ = '2.1.6' __AIkey__ = '95b20d64-f54f-4de3-8ad5-165a75a6c6fe' diff --git a/iotedgedev/telemetryconfig.py b/iotedgedev/telemetryconfig.py index aec28d22..36f134b7 100644 --- a/iotedgedev/telemetryconfig.py +++ b/iotedgedev/telemetryconfig.py @@ -43,7 +43,12 @@ def setup(self): @suppress_all_exceptions() def load(self): with open(self.get_config_path(), 'r') as f: - self.config_parser.readfp(f) + if hasattr(self.config_parser, 'read_file'): + self.config_parser.read_file(f) + else: # pragma: no cover + assert PY2 + # The `read_file` method is not available on ConfigParser in py2.7! + self.config_parser.readfp(f) @suppress_all_exceptions() def dump(self): diff --git a/setup.cfg b/setup.cfg index 0cfc571c..258c9b1f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.1.5 +current_version = 2.1.6 commit = True tag = True diff --git a/setup.py b/setup.py index 40672209..0980de80 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ setup( name='iotedgedev', - version='2.1.5', + version='2.1.6', description='The Azure IoT Edge Dev Tool greatly simplifies the IoT Edge development process by automating many routine manual tasks, such as building, deploying, pushing modules and configuring the IoT Edge Runtime.', long_description='See https://github.com/azure/iotedgedev for usage instructions.', author='Microsoft Corporation',