Skip to content

Commit 349a84b

Browse files
committed
Fixing CI and formatting
1 parent db8651b commit 349a84b

3 files changed

Lines changed: 42 additions & 33 deletions

File tree

.github/workflows/test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,19 @@ jobs:
1313
strategy:
1414
matrix:
1515
python-version: ['3.13']
16+
omc-version: ['stable']
1617

1718
steps:
1819
- name: Checkout code
1920
uses: actions/checkout@v4
2021

22+
- name: "Set up OpenModelica Compiler"
23+
uses: OpenModelica/setup-openmodelica@v1.0
24+
with:
25+
version: ${{ matrix.omc-version }}
26+
packages: |
27+
omc
28+
2129
- name: Set up Python ${{ matrix.python-version }}
2230
uses: actions/setup-python@v5
2331
with:

ompackagemanager/updateinfo.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def new_libentry(libname: str,
143143
entry,
144144
hits: list[str],
145145
repopath: str,
146-
omc: OMPython.OMCSessionZMQ) -> dict[str,str]:
146+
omc: OMPython.OMCSessionZMQ) -> dict[str, str]:
147147
"""Create new entry for Modelica library.
148148
149149
Args:
@@ -345,11 +345,12 @@ def main():
345345
hits += hitsNew
346346
if len(hits) != 1:
347347
print(str(len(hits)) + " hits for " + libname + " in " + tagName + ": " + str(hits))
348-
print("Check that " +
349-
libname +
350-
"/package.mo exists in tag: " +
351-
tagName +
352-
". Maybe wrong spelling? If different naming than the repo add it to the 'names' for the lib in repos.json")
348+
print(
349+
"Check that " +
350+
libname +
351+
"/package.mo exists in tag: " +
352+
tagName +
353+
". Maybe wrong spelling? If different naming than the repo add it to the 'names' for the lib in repos.json")
353354
continue
354355
omc.sendExpression("clear()")
355356
if "standard" in entry:

tests/test_libentry.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TestNewLibentry(unittest.TestCase):
1414
def setUpClass(cls):
1515
"""Clone git repositories, start OMC session."""
1616

17-
def checkout_repo(github_repo:str, refname:str) -> str:
17+
def checkout_repo(github_repo: str, refname: str) -> str:
1818
"""Clone and checkout a git repository from GitHub"""
1919
giturl = "https://github.com/%s.git" % github_repo
2020
repopath = os.path.join(cls.cache_dir, github_repo.split("/")[-1])
@@ -34,7 +34,6 @@ def checkout_repo(github_repo:str, refname:str) -> str:
3434

3535
return os.path.normpath(os.path.join(gitrepo.path, os.pardir))
3636

37-
3837
cls.cache_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp-cache")
3938
os.makedirs(cls.cache_dir, exist_ok=True)
4039

@@ -48,7 +47,7 @@ def checkout_repo(github_repo:str, refname:str) -> str:
4847
def tearDownClass(cls):
4948
"""Remove git repositories, stop OMC session."""
5049
cls.omc.sendExpression("exit")
51-
#shutil.rmtree(cls.cache_dir)
50+
shutil.rmtree(cls.cache_dir)
5251

5352
def tearDown(self):
5453
"""Clear omc session"""
@@ -81,12 +80,12 @@ def test_aixlib_tag_version(self):
8180
self.omc.sendExpression('loadFile("%s", uses=false)' % hits[0])
8281

8382
libentry = new_libentry(
84-
libname = libname,
85-
tagName = tagName,
86-
entry = entry,
87-
hits = hits,
88-
repopath = repopath,
89-
omc = self.omc
83+
libname=libname,
84+
tagName=tagName,
85+
entry=entry,
86+
hits=hits,
87+
repopath=repopath,
88+
omc=self.omc
9089
)
9190

9291
expected_libentry = {
@@ -98,7 +97,7 @@ def test_aixlib_tag_version(self):
9897
"SDF": "0.4.2"
9998
},
10099
"convertFromVersion": [
101-
"2.1.0"
100+
"2.1.0"
102101
],
103102
}
104103
self.assertDictEqual(libentry, expected_libentry)
@@ -134,36 +133,37 @@ def test_modelica_master_version(self):
134133
self.omc.sendExpression('loadFile("%s", uses=false)' % hits[0])
135134

136135
libentry = new_libentry(
137-
libname = libname,
138-
tagName = branch,
139-
entry = entry,
140-
hits = hits,
141-
repopath = repopath,
142-
omc = self.omc
136+
libname=libname,
137+
tagName=branch,
138+
entry=entry,
139+
hits=hits,
140+
repopath=repopath,
141+
omc=self.omc
143142
)
144143

145144
expected_libentry = {
146145
"version": "4.2.0-dev",
147146
"path": "Modelica",
148147
"uses": {
149-
"Complex": "4.2.0-dev",
150-
"ModelicaServices": "4.2.0-dev"
148+
"Complex": "4.2.0-dev",
149+
"ModelicaServices": "4.2.0-dev"
151150
},
152151
"provides": [
153-
"4.0.0",
154-
"4.1.0"
152+
"4.0.0",
153+
"4.1.0"
155154
],
156155
"convertFromVersion": [
157-
"3.0.0",
158-
"3.0.1",
159-
"3.1.0",
160-
"3.2.0",
161-
"3.2.1",
162-
"3.2.2",
163-
"3.2.3"
156+
"3.0.0",
157+
"3.0.1",
158+
"3.1.0",
159+
"3.2.0",
160+
"3.2.1",
161+
"3.2.2",
162+
"3.2.3"
164163
]
165164
}
166165
self.assertDictEqual(libentry, expected_libentry)
167166

167+
168168
if __name__ == "__main__":
169169
unittest.main()

0 commit comments

Comments
 (0)