Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an integration test for consistency with common-definitions #6

Merged
merged 7 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/integration.yaml
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'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### common-definitions ###
common-definitions

### IntelliJ PyCharm ###
.idea/

Expand Down
6 changes: 0 additions & 6 deletions definitions/variable/variable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -513,12 +513,6 @@
- Consumption:
definition: total consumption of all goods, by all consumers in a region
unit: billion US$2010/yr
- GDP|MER:
definition: GDP at market exchange rate
unit: billion US$2010/yr
- GDP|PPP:
definition: GDP converted to International $ using purchasing power parity (PPP)
unit: billion US$2010/yr
- Value Added|Agriculture:
definition: value added of the agricultural sector
unit: billion US$2010/yr
Expand Down
29 changes: 29 additions & 0 deletions tests/test_integration.py
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)

danielhuppmann marked this conversation as resolved.
Show resolved Hide resolved
try:
nomenclature.DataStructureDefinition("definitions")

danielhuppmann marked this conversation as resolved.
Show resolved Hide resolved
finally:
pathlib.Path(config_file).unlink()
Loading