Skip to content

Commit

Permalink
use the recommended yaml.safe_load function
Browse files Browse the repository at this point in the history
reason: with pyyaml >= 5, the load function without Loader is deprecated.
Even if we do not use version 5 for now, we should use good practices.
https://pyyaml.org/wiki/PyYAMLDocumentation#loading-yaml
yaml/pyyaml#257
  • Loading branch information
fblackburn1 committed Apr 16, 2019
1 parent fbf95aa commit 8d2801f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions xivo_confgen/tests/test_dird.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2018 The Wazo Authors (see the AUTHORS file)
# Copyright 2015-2019 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

import unittest
Expand Down Expand Up @@ -38,7 +38,7 @@ def test_views_yml(self, _DisplayGenerator, _PhoneAssociationGenerator, _Associa
'profile_to_display': 'associations',
'profile_to_display_phone': 'phone_associations'}}

assert_that(yaml.load(result), equal_to(expected))
assert_that(yaml.safe_load(result), equal_to(expected))


class TestNoContextSeparationDirdFrontendViewsGenerators(unittest.TestCase):
Expand Down Expand Up @@ -197,4 +197,4 @@ def test_services_yml(self):
'favorites': 'favorites',
'reverse': 'reverses'}}

assert_that(yaml.load(result), equal_to(expected))
assert_that(yaml.safe_load(result), equal_to(expected))
4 changes: 2 additions & 2 deletions xivo_confgen/tests/test_dird_phoned.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Avencall
# Copyright 2015-2019 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

import unittest
Expand Down Expand Up @@ -27,4 +27,4 @@ def test_config_yml(self, mock_phone_access_dao):
}
}

assert_that(yaml.load(result), equal_to(expected))
assert_that(yaml.safe_load(result), equal_to(expected))
4 changes: 2 additions & 2 deletions xivo_confgen/tests/test_xivo.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Avencall
# Copyright 2015-2019 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

import yaml
Expand Down Expand Up @@ -29,4 +29,4 @@ def test_uuid_yml(self):
'uuid': 'sentinel-uuid',
}

assert_that(yaml.load(result), equal_to(expected))
assert_that(yaml.safe_load(result), equal_to(expected))

0 comments on commit 8d2801f

Please sign in to comment.