Skip to content

Commit

Permalink
test(fix): Allow missing extension.json file in non-extension reposit…
Browse files Browse the repository at this point in the history
…ories
  • Loading branch information
jpmckinney committed Jan 18, 2024
1 parent bb44a5e commit 0ffb363
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions tests/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@
}


def read_metadata():
def read_metadata(allow_missing=False):
path = os.path.join(cwd, 'extension.json')
if allow_missing and not os.path.isfile(path):
return {}
with open(path) as f:
return json.load(f)

Expand All @@ -96,7 +98,7 @@ def read_metadata():
# Extensions that depend on those extensions.
or (
'https://raw.githubusercontent.com/open-contracting-extensions/ocds_lots_extension/master/extension.json'
in read_metadata().get('testDependencies', [])
in read_metadata(allow_missing=True).get('testDependencies', [])
)
)

Expand Down
6 changes: 4 additions & 2 deletions tests/test_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
from ocdskit.schema import get_schema_fields


def read_metadata():
def read_metadata(allow_missing=False):
path = os.path.join(cwd, 'extension.json')
if allow_missing and not os.path.isfile(path):
return {}
with open(path) as f:
return json.load(f)

Expand All @@ -37,7 +39,7 @@ def read_metadata():
# Extensions that depend on those extensions.
or (
'https://raw.githubusercontent.com/open-contracting-extensions/ocds_lots_extension/master/extension.json'
in read_metadata().get('testDependencies', [])
in read_metadata(allow_missing=True).get('testDependencies', [])
)
)

Expand Down

0 comments on commit 0ffb363

Please sign in to comment.