threefoldtecharchive / jumpscaleX_core

Apache License 2.0
1 stars 6 forks source link

Schema texts with colon in any line are broken #409

Closed abom closed 4 years ago

abom commented 4 years ago

Running the tests:

kosmos -p 'j.data.schema.test("unittests")'

Schema used:

        scm = """
        @url = test.schema
        data = (h)
        init_hash = 46:682 (h)
        """

Error:

Traceback (most recent call last):
  File "/sandbox/code/github/threefoldtech/jumpscaleX_core/JumpscaleCore/data/schema/tests/testsuite/testcases/test_schema.py", line 883, in test017_validate_hash_type
    schema_obj = schema.new()
  File "/sandbox/lib/jumpscale/Jumpscale/data/schema/tests/testsuite/framework/schema.py", line 35, in new
    self.schema_obj = self.schema_obj or self.schema_object
  File "/sandbox/lib/jumpscale/Jumpscale/data/schema/tests/testsuite/framework/schema.py", line 31, in schema_object
    self.schema_obj = j.data.schema.get_from_text(schema_text=self.schema)
  File "/sandbox/lib/jumpscale/Jumpscale/data/schema/SchemaFactory.py", line 161, in get_from_text
    res.append(self._get_from_text_single(block, url=url, newest=newest, save=save))
  File "/sandbox/lib/jumpscale/Jumpscale/data/schema/SchemaFactory.py", line 228, in _get_from_text_single
    s = Schema(text=schema_text, url=url, md5=md5)
  File "/sandbox/lib/jumpscale/Jumpscale/core/BASECLASSES/JSBase.py", line 44, in __init__
    self._init(**kwargs)
  File "/sandbox/lib/jumpscale/Jumpscale/data/schema/Schema.py", line 23, in _init
    self._schema_from_text(text)
  File "/sandbox/lib/jumpscale/Jumpscale/data/schema/Schema.py", line 127, in _schema_from_text
    p = self._property_get_from_line(line)
  File "/sandbox/lib/jumpscale/Jumpscale/data/schema/Schema.py", line 151, in _property_get_from_line
    nr = int(nr)
ValueError: invalid literal for int() with base 10: 'init_hash = 46'
abom commented 4 years ago

Fixed in https://github.com/threefoldtech/jumpscaleX_core/commit/3a486306ca9873ccd468eecb96d50396116d0404.

AhmedHanafy725 commented 4 years ago

Verified branch: development_hotfixes commit: 47c51f4147b67d68acad32973590b6db605a1bd9

JSX> j.data.schema.test("unittests")                                                                 
.........................................
----------------------------------------------------------------------
Ran 41 tests in 2.083s

OK