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
This commit is contained in:
Mariana Mihova 2020-09-24 04:28:42 +00:00 коммит произвёл GitHub
Родитель 4c7c56be01
Коммит addfd992a6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 25 добавлений и 5 удалений

13
.vscode/launch.json поставляемый
Просмотреть файл

@ -1,13 +1,24 @@
{ {
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "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", "name": "Python Module",
"type": "python", "type": "python",
"request": "launch", "request": "launch",
"module": "iotedgedev.cli", "module": "iotedgedev.cli",
"args": [ "args": [
"push" "init"
], ],
"cwd": "${workspaceFolder}/tests/test_solution" "cwd": "${workspaceFolder}/tests/test_solution"
} }

Просмотреть файл

@ -1,6 +1,10 @@
# Changelog # Changelog
All notable changes to this project since 0.82.0 will be documented in this file. 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 ## [2.1.5] - 2020-08-18
### Changed ### Changed
- Fix error caused by latest bcrypt on Azure Pipelines agent - Fix error caused by latest bcrypt on Azure Pipelines agent

Просмотреть файл

@ -4,5 +4,5 @@
__author__ = 'Microsoft Corporation' __author__ = 'Microsoft Corporation'
__email__ = 'vsciet@microsoft.com' __email__ = 'vsciet@microsoft.com'
__version__ = '2.1.5' __version__ = '2.1.6'
__AIkey__ = '95b20d64-f54f-4de3-8ad5-165a75a6c6fe' __AIkey__ = '95b20d64-f54f-4de3-8ad5-165a75a6c6fe'

Просмотреть файл

@ -43,7 +43,12 @@ class TelemetryConfig(object):
@suppress_all_exceptions() @suppress_all_exceptions()
def load(self): def load(self):
with open(self.get_config_path(), 'r') as f: 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() @suppress_all_exceptions()
def dump(self): def dump(self):

Просмотреть файл

@ -1,5 +1,5 @@
[bumpversion] [bumpversion]
current_version = 2.1.5 current_version = 2.1.6
commit = True commit = True
tag = True tag = True

Просмотреть файл

@ -45,7 +45,7 @@ test_requirements = [
setup( setup(
name='iotedgedev', 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.', 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.', long_description='See https://github.com/azure/iotedgedev for usage instructions.',
author='Microsoft Corporation', author='Microsoft Corporation',