generated from iiasa/scse-workflow-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an integration test for consistency with common-definitions (#6)
- Loading branch information
1 parent
8179cac
commit e55780b
Showing
4 changed files
with
60 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This workflow checks that no conflicts exist with the common-definitions repo | ||
|
||
name: Check consistency with common-definitions | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ '**' ] | ||
schedule: | ||
- cron: '45 5 * * *' | ||
|
||
jobs: | ||
project-validation: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install requirements | ||
run: pip install nomenclature-iamc pytest | ||
|
||
- name: Run the integration test | ||
run: pytest tests/test_integration.py --rootdir='tests' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
### common-definitions ### | ||
common-definitions | ||
|
||
### IntelliJ PyCharm ### | ||
.idea/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import pathlib | ||
import yaml | ||
|
||
import nomenclature | ||
|
||
|
||
def test_integration_common_definitions(): | ||
|
||
config_file = "nomenclature.yaml" | ||
config = { | ||
"repositories": { | ||
"common-definitions": { | ||
"url": "https://github.com/IAMconsortium/common-definitions.git/" | ||
} | ||
}, | ||
"definitions": { | ||
"region": {"repository": "common-definitions"}, | ||
"variable": {"repository": "common-definitions"}, | ||
}, | ||
} | ||
|
||
with open(config_file, "w") as file: | ||
yaml.dump(config, file) | ||
|
||
try: | ||
nomenclature.DataStructureDefinition("definitions") | ||
|
||
finally: | ||
pathlib.Path(config_file).unlink() |