Skip to content

Commit

Permalink
Path confusion with schema
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-vsarvepalli committed Jul 12, 2024
1 parent 24ddbc1 commit ecfba7d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/test/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
from ssvc.dp_groups.ssvc.collections import SSVCv1, SSVCv2, SSVCv2_1 # noqa

def retrieve_local(uri):
basepath = uri.replace("https://certcc.github.io/SSVC", "")
for pfx in (".", "..", "../.."):
path = os.path.join(pfx, basepath)
if os.path.exists(path):
fh = open(path)
schema = json.load(fh)
fh.close()
return Resource.from_contents(schema)
raise FileNotFoundError(f"Could not find {basepath}")
fileuri = uri.replace("https://certcc.github.io/SSVC", "")
mypath = os.path.realpath(__file__)
path = "../.." + fileuri
if os.path.exists(path):
fh = open(path)
schema = json.load(fh)
fh.close()
return Resource.from_contents(schema)
raise FileNotFoundError(f"Could not find {path} {mypath}")

registry = Registry(retrieve=retrieve_local)

Expand Down

0 comments on commit ecfba7d

Please sign in to comment.