From 392c3262dcb4108b42f09e1369d9072502302361 Mon Sep 17 00:00:00 2001 From: James Falcon Date: Thu, 30 Sep 2021 18:26:50 -0500 Subject: pin jsonschema in requirements.txt (#1043) On unit tests, tox is attempting to install 4.0, which fails two of the unit tests, and fails python 3.5 as it is not compatible. --- test-requirements.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'test-requirements.txt') diff --git a/test-requirements.txt b/test-requirements.txt index 0a6a04d4..61fb9b03 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,3 +5,4 @@ pytest-cov # Only really needed on older versions of python setuptools +jsonschema==3.2.0 -- cgit v1.2.3 From 2db713346d656c3486228678ad020b56440c1e34 Mon Sep 17 00:00:00 2001 From: James Falcon Date: Fri, 22 Oct 2021 22:06:51 -0500 Subject: Remove pin in dependencies for jsonschema (#1078) In jsonschema 4, hostname validation was changed to have an optional dependency on the fqdn package. Since we don't have this dependency in cloud-init, attempting this validation will no longer fail for a string that isn't a valid hostname. --- requirements.txt | 2 +- test-requirements.txt | 2 +- tests/unittests/test_handler/test_schema.py | 10 +++++----- tox.ini | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test-requirements.txt') diff --git a/requirements.txt b/requirements.txt index 27cef184..c4adc455 100644 --- a/requirements.txt +++ b/requirements.txt @@ -31,7 +31,7 @@ requests jsonpatch # For validating cloud-config sections per schema definitions -jsonschema==3.2.0 +jsonschema # Used by DataSourceVMware to inspect the host's network configuration during # the "setup()" function. diff --git a/test-requirements.txt b/test-requirements.txt index 61fb9b03..06dfbbec 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,4 +5,4 @@ pytest-cov # Only really needed on older versions of python setuptools -jsonschema==3.2.0 +jsonschema diff --git a/tests/unittests/test_handler/test_schema.py b/tests/unittests/test_handler/test_schema.py index 6b0b1f74..6f37ceb7 100644 --- a/tests/unittests/test_handler/test_schema.py +++ b/tests/unittests/test_handler/test_schema.py @@ -108,11 +108,11 @@ class ValidateCloudConfigSchemaTest(CiTestCase): def test_validateconfig_schema_honors_formats(self): """With strict True, validate_cloudconfig_schema errors on format.""" schema = { - 'properties': {'p1': {'type': 'string', 'format': 'hostname'}}} + 'properties': {'p1': {'type': 'string', 'format': 'email'}}} with self.assertRaises(SchemaValidationError) as context_mgr: validate_cloudconfig_schema({'p1': '-1'}, schema, strict=True) self.assertEqual( - "Cloud config schema errors: p1: '-1' is not a 'hostname'", + "Cloud config schema errors: p1: '-1' is not a 'email'", str(context_mgr.exception)) @@ -189,12 +189,12 @@ class ValidateCloudConfigFileTest(CiTestCase): def test_validateconfig_file_sctrictly_validates_schema(self): """validate_cloudconfig_file raises errors on invalid schema.""" schema = { - 'properties': {'p1': {'type': 'string', 'format': 'hostname'}}} - write_file(self.config_file, '#cloud-config\np1: "-1"') + 'properties': {'p1': {'type': 'string', 'format': 'string'}}} + write_file(self.config_file, '#cloud-config\np1: -1') with self.assertRaises(SchemaValidationError) as context_mgr: validate_cloudconfig_file(self.config_file, schema) self.assertEqual( - "Cloud config schema errors: p1: '-1' is not a 'hostname'", + "Cloud config schema errors: p1: -1 is not of type 'string'", str(context_mgr.exception)) diff --git a/tox.ini b/tox.ini index f0c22cdb..874d3f20 100644 --- a/tox.ini +++ b/tox.ini @@ -77,7 +77,7 @@ deps = pyserial==3.0.1 configobj==5.0.6 requests==2.9.1 - jsonschema==3.2.0 + jsonschema # test-requirements pytest-catchlog==1.2.1 -- cgit v1.2.3