Commit e43dc869 authored by M. Huang's avatar M. Huang
Browse files

1.30.3 data included in wheel. test_schema not fixed when package installed.

parent 76766059
No related merge requests found
Showing with 47 additions and 590 deletions
+47 -590
......@@ -117,6 +117,10 @@ wheel:
upload:
$(PYEXE) -m twine upload --repository $(PYREPO) dist/*
FDI_WHEEL_DIR = ./dist #../wheel
wheel_install:
$(PYEXE) -m pip install fdi $(I) --disable-pip-version-check --cache-dir ../../pipcache --no-index -f $(FDI_WHEEL_DIR)
virtest:
rm -rf /tmp/fditestvirt
virtualenv -p $(PYEXE) /tmp/fditestvirt
......
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
requests = "*"
filelock = "*"
"ruamel.yaml" = "*"
tabulate = "*"
paho-mqtt = "*"
[dev-packages]
pytest = "*"
pytest-cov = "*"
aiohttp = "*"
flask = "*"
flask-httpauth = "*"
[requires]
python_version = "3.6"
This diff is collapsed.
__version_info__ = (1, 30, 2)
__version_info__ = (1, 30, 3)
__version__ = '.'.join(map(str, __version_info__))
# 1.30.3 data included in wheel. test_schema not fixed when package installed.
# 1.30.2 common::find_all_files and makeSchemaStore accept imported packages.
# 1.30.1 testproducts gets version update for csdb debugging. csdb serialiswitched from json to fdi
# 1.30.0 GlobalPoolList not weakref anymore, working with server sessions. make login/out, saved cookies work. efficient update of pool HK by csdb backend. improve conftest efficiency for csdb.
......
......@@ -8,7 +8,7 @@ def getSwag():
ypath = os.path.abspath(os.path.join(
os.path.dirname(__file__), '../schema'))
print('************ swagger yaml dir:', ypath)
print('swagger yaml dir:', ypath)
# Use a yaml file derefed with swagger-cli bundle -r
full_doc = load_from_file(os.path.join(ypath, 'pools_resolved.yml'))
yaml_start = full_doc.find('---')
......
......@@ -30,6 +30,8 @@ setup(
url="http://mercury.bao.ac.cn:9006/mh/fdi",
packages=find_packages(exclude=['tests', 'tmp', 'docs']),
include_package_data=True,
package_data={'': ['*.yml', '*.yaml', '*.jsn', '*.json', '*.txt']},
exclude_package_data={"": [".git*"]},
long_description=read('README.rst'),
long_description_content_type="text/x-rst",
python_requires=">=3.6",
......
......@@ -77,7 +77,7 @@ def test_packaged(t_package):
if 1:
jsn = json.loads(serialize('urn:pool:si.PL:20'))
vtr = getValidator(sch, verbose=verbose)
vtr = getValidator(sch, base_schema=sch, verbose=verbose)
assert vtr.validate(jsn) is None
......@@ -283,7 +283,7 @@ def test_a_array(schema_store):
with pytest.raises(ValidationError):
assert vtr.validate(bad) is None
finally:
fdi.dataset.serializable.GZIP= saved
fdi.dataset.serializable.GZIP = saved
# "example ignores jsn
check_examples_defaults(vtr, sch, jsn, ['examples'])
......@@ -292,50 +292,50 @@ def test_a_array(schema_store):
def test_RQSTID(schema_store):
""" Test setting requires:['_STID'] with schema "Require_STID".
"""
scn= 'TEST_STID'
sch= schema_store[SSP % ('', scn)]
scn = 'TEST_STID'
sch = schema_store[SSP % ('', scn)]
sch['$ref']= "Require_STID_True"
vtr= getValidator(sch, verbose=verbose)
jsn= {"foo": "bar", "_STID": "byte"}
sch['$ref'] = "Require_STID_True"
vtr = getValidator(sch, verbose=verbose)
jsn = {"foo": "bar", "_STID": "byte"}
assert vtr.validate(jsn) is None
# error from no _STID
jsn= {"foo": "bar", "m_STID": "byte"}
jsn = {"foo": "bar", "m_STID": "byte"}
with pytest.raises(ValidationError):
assert vtr.validate(jsn) is None
with pytest.raises(ValidationError):
assert vtr.validate({}) is None
# pass
sch['$ref']= "Require_STID_False"
vtr= getValidator(sch, verbose=verbose)
jsn= {"foo": "bar", "_STID": "byte"}
sch['$ref'] = "Require_STID_False"
vtr = getValidator(sch, verbose=verbose)
jsn = {"foo": "bar", "_STID": "byte"}
assert vtr.validate(jsn) is None
jsn= {"foo": "bar", "m_STID": "byte"}
jsn = {"foo": "bar", "m_STID": "byte"}
assert vtr.validate(jsn) is None
assert vtr.validate({}) is None
def test_preset_STID(schema_store):
scn= 'TEST_STID'
sch= schema_store[SSP % ('', scn)]
scn = 'TEST_STID'
sch = schema_store[SSP % ('', scn)]
# constant preset _STID
sch['properties']['_STID']= {"const": "Foo"}
vtr= getValidator(sch, verbose=verbose)
jsn= {"foo": "bar", "_STID": "Foo"}
sch['properties']['_STID'] = {"const": "Foo"}
vtr = getValidator(sch, verbose=verbose)
jsn = {"foo": "bar", "_STID": "Foo"}
assert vtr.validate(jsn) is None
# wrong STID
jsn= {"foo": "bar", "_STID": "bytes"}
jsn = {"foo": "bar", "_STID": "bytes"}
with pytest.raises(ValidationError):
assert vtr.validate(jsn) is None
# missing
jsn= {"foo": "bar"}
jsn = {"foo": "bar"}
with pytest.raises(ValidationError):
assert vtr.validate(jsn) is None
# also wrong
jsn= json.loads('{"foo":"bar", "_STID":"bytes,gz"}')
jsn = json.loads('{"foo":"bar", "_STID":"bytes,gz"}')
with pytest.raises(ValidationError):
assert vtr.validate(jsn) is None
# empty
......@@ -343,15 +343,15 @@ def test_preset_STID(schema_store):
assert vtr.validate({}) is None
# modift schema to have list of possible IDs in preset _STID
sch['properties']['_STID']= {"enum": ["bytes", "bytes,gz"]}
vtr= getValidator(sch, verbose=verbose)
jsn= {"foo": "bar", "_STID": "bytes,gz"}
sch['properties']['_STID'] = {"enum": ["bytes", "bytes,gz"]}
vtr = getValidator(sch, verbose=verbose)
jsn = {"foo": "bar", "_STID": "bytes,gz"}
assert vtr.validate(jsn) is None
jsn= {"foo": "bar", "_STID": "bytes"}
jsn = {"foo": "bar", "_STID": "bytes"}
assert vtr.validate(jsn) is None
# errors in STID in instane
jsn= {"foo": "bar", "_STID": "bytes,g"}
jsn = {"foo": "bar", "_STID": "bytes,g"}
with pytest.raises(ValidationError):
assert vtr.validate(jsn) is None
with pytest.raises(ValidationError):
......@@ -359,7 +359,7 @@ def test_preset_STID(schema_store):
# Properties is anyOf
del sch['properties']
sch["anyOf"]= [
sch["anyOf"] = [
{'properties': {
"foo": {"const": "deadbeef"},
"_STID": {"type": "string", "pattern": "^bytes$"}
......@@ -369,37 +369,37 @@ def test_preset_STID(schema_store):
}
]
vtr= getValidator(sch, verbose=verbose)
jsn= {"foo": "bar", "_STID": "bytes,gz"}
vtr = getValidator(sch, verbose=verbose)
jsn = {"foo": "bar", "_STID": "bytes,gz"}
assert vtr.validate(jsn) is None
jsn= {"foo": "deadbeef", "_STID": "bytes"}
jsn = {"foo": "deadbeef", "_STID": "bytes"}
assert vtr.validate(jsn) is None
# error in foo: when STID=='gzip'
jsn= {"foo": "bar", "_STID": "bytes"}
jsn = {"foo": "bar", "_STID": "bytes"}
with pytest.raises(ValidationError):
assert vtr.validate(jsn) is None
# errors in STID in instane
jsn= {"foo": "bar", "_STID": "bytes,g"}
jsn = {"foo": "bar", "_STID": "bytes,g"}
with pytest.raises(ValidationError):
assert vtr.validate(jsn) is None
with pytest.raises(ValidationError):
assert vtr.validate({"_STID": None}) is None
# modify STID to ""
jsn= {"foo": "bar", "_STID": "g"}
jsn = {"foo": "bar", "_STID": "g"}
with pytest.raises(ValidationError):
assert vtr.validate(jsn) is None
def test_urn(schema_store):
scn= 'Urn'
sch= schema_store[SSP % ('pal/', scn)]
scn = 'Urn'
sch = schema_store[SSP % ('pal/', scn)]
if 1:
jsn= json.loads(serialize('urn:pool:si.PL:20'))
vtr= getValidator(sch, verbose=verbose)
jsn = json.loads(serialize('urn:pool:si.PL:20'))
vtr = getValidator(sch, verbose=verbose)
assert vtr.validate(jsn) is None
check_examples_defaults(vtr, sch, jsn, [
......@@ -407,8 +407,8 @@ def test_urn(schema_store):
])
# invalid urn in 'urns'
cpy= copy.deepcopy(jsn)
bad= cpy.replace("urn:", "urn::")
cpy = copy.deepcopy(jsn)
bad = cpy.replace("urn:", "urn::")
with pytest.raises(ValidationError):
assert getValidator(sch, verbose=verbose).validate(bad) is None
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment