Skip to content

Commit

Permalink
Add an integration test for consistency with common-definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuppmann committed Feb 15, 2024
1 parent 8179cac commit 6d73bc4
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
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
27 changes: 27 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pathlib
import yaml

import nomenclature


def test_integration_common_definitions():

config_file = "../definitions/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)

nomenclature.DataStructureDefinition("../definitions")

pathlib.Path(config_file).unlink()

0 comments on commit 6d73bc4

Please sign in to comment.