From 5f8c965b3947ca8cf7d9d3c705495aa7a62688cb Mon Sep 17 00:00:00 2001 From: Brad Cowie Date: Tue, 13 Aug 2019 10:19:04 +1200 Subject: [PATCH 1/3] Use pyyaml 3.13 or older (avoid 5.x for now). --- debian/control | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 4ac05c661d..1a9dbe7f31 100644 --- a/debian/control +++ b/debian/control @@ -35,7 +35,7 @@ Depends: python3-oslo.config (>= 1:3.9~), python3-networkx (>= 1.9), python3-pbr (>= 1.9), python3-prometheus-client (>= 0.7.1), python3-prometheus-client (<< 0.7.2), - python3-yaml (>= 3.1.1), + python3-yaml (>= 3.1.1), python3-yaml (<= 3.13), python3-eventlet (>= 0.24.1), python3-eventlet (<< 0.24.2), python3-ryu (>= 4.32), python3-ryu (<< 4.33), python3-beka (>= 0.3.3), python3-beka (<< 0.3.4), diff --git a/requirements.txt b/requirements.txt index d1e6c8a58f..e6a331002a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ msgpack-python networkx pbr>=1.9 prometheus_client==0.7.1 -pyyaml +pyyaml>=3.1.1,<=3.13 ryu==4.32 beka==0.3.3 pytricia From 36c12c0d89f5073ddf808ff11d58da1e5221f05e Mon Sep 17 00:00:00 2001 From: Brad Cowie Date: Tue, 13 Aug 2019 11:40:28 +1200 Subject: [PATCH 2/3] Open file as UTF8. --- tests/unit/packaging/test_packaging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/packaging/test_packaging.py b/tests/unit/packaging/test_packaging.py index 98a6b59d4a..24364777dc 100755 --- a/tests/unit/packaging/test_packaging.py +++ b/tests/unit/packaging/test_packaging.py @@ -43,7 +43,7 @@ def setUp(self): 'pyyaml': 'python3-yaml' } - with open(self.control_file) as handle: + with open(self.control_file, 'r', encoding='utf-8') as handle: control = handle.read() faucet_dpkg = str() From ee507cdc9dcdb6fca048ad4b8782f949b7b8f117 Mon Sep 17 00:00:00 2001 From: Brad Cowie Date: Tue, 13 Aug 2019 11:49:43 +1200 Subject: [PATCH 3/3] Need to check version comparators separately. --- tests/unit/packaging/test_packaging.py | 29 +++++++++++++------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/unit/packaging/test_packaging.py b/tests/unit/packaging/test_packaging.py index 24364777dc..0db95fc1d0 100755 --- a/tests/unit/packaging/test_packaging.py +++ b/tests/unit/packaging/test_packaging.py @@ -88,23 +88,24 @@ def test_every_pip_requirement_has_matching_version_in_debian_package(self): dpkg_name = "python3-{}".format(pip_req.name) if pip_req.req.specifier: - pip_req_version = str(pip_req.req.specifier) + pip_req_versions = str(pip_req.req.specifier) debian_package_dependencies = [ pip_req.name+x for x in self.faucet_dpkg_deps[dpkg_name] ] - if str(pip_req_version).startswith('=='): - # debian/control is annoying about how it handles exact - # versions, calculate the debian equivalent of the - # pip requirements match and compare that - lower_match = pip_req_version.replace('==', '>=') - upper_match = pip_req_version.replace('==', '<<').split('.') - upper_match[-1] = str(int(upper_match[-1]) + 1) - upper_match = '.'.join(upper_match) - - self.assertIn(pip_req.name+lower_match, debian_package_dependencies) - self.assertIn(pip_req.name+upper_match, debian_package_dependencies) - else: - self.assertIn(pip_req.name+pip_req_version, debian_package_dependencies) + for pip_req_version in pip_req_versions.split(','): + if str(pip_req_version).startswith('=='): + # debian/control is annoying about how it handles exact + # versions, calculate the debian equivalent of the + # pip requirements match and compare that + lower_match = pip_req_version.replace('==', '>=') + upper_match = pip_req_version.replace('==', '<<').split('.') + upper_match[-1] = str(int(upper_match[-1]) + 1) + upper_match = '.'.join(upper_match) + + self.assertIn(pip_req.name+lower_match, debian_package_dependencies) + self.assertIn(pip_req.name+upper_match, debian_package_dependencies) + else: + self.assertIn(pip_req.name+pip_req_version, debian_package_dependencies) if __name__ == "__main__":