Skip to content

Commit 5d343b6

Browse files
Merge pull request #55 from openMetadataInitiative/more-testing
Run tests for "v3" and "v4" in addition to "latest"
2 parents de42dc9 + 3dc4a5b commit 5d343b6

File tree

2 files changed

+29
-23
lines changed

2 files changed

+29
-23
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ jobs:
2525
2626
- name: Test built package
2727
run: |
28-
pip install pytest
28+
pip install pytest pytest-cov
2929
pip install ./target
30-
pytest -v pipeline/tests
30+
pytest -v --cov=openminds --cov-report term pipeline/tests

pipeline/tests/test_instantiation.py

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,39 @@
22
Tests for openMINDS Python module
33
"""
44

5+
from importlib import import_module
6+
import sys
7+
58
import pytest
69

710
from openminds.base import Node, IRI
8-
from openminds.latest import (
9-
chemicals,
10-
computation,
11-
controlled_terms,
12-
core,
13-
ephys,
14-
publications,
15-
sands,
16-
specimen_prep,
17-
stimulation,
18-
)
11+
1912
from utils import build_fake_node
2013

21-
all_modules = (
22-
chemicals,
23-
computation,
24-
controlled_terms,
25-
core,
26-
ephys,
27-
publications,
28-
sands,
29-
specimen_prep,
30-
stimulation,
14+
module_names = (
15+
"chemicals",
16+
"computation",
17+
"controlled_terms",
18+
"core",
19+
"ephys",
20+
"publications",
21+
"sands",
22+
"specimen_prep",
23+
"stimulation",
3124
)
25+
versions = ("v3", "v4", "latest") # "v1" and "v2" currently produce errors
26+
27+
all_modules = []
28+
for version in versions:
29+
for module_name in module_names:
30+
path = f"openminds.{version}.{module_name}"
31+
try:
32+
module = import_module(path)
33+
except ModuleNotFoundError:
34+
continue
35+
else:
36+
sys.modules[path] = module
37+
all_modules.append(module)
3238

3339

3440
def classes_in_module(module):

0 commit comments

Comments
 (0)