Skip to content

Commit 056e46c

Browse files
committed
Tests: skip COM test if the modules are not installed
We should install/register a COM DLL from EPRI to test this.
1 parent 370f15a commit 056e46c

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

tests/test_general.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,12 @@ def test_patch_comtypes():
917917
pytest.skip("Skipping COM test; OpenDSSDirect.DLL already loaded.")
918918
return
919919

920-
import comtypes.client
920+
try:
921+
import comtypes.client
922+
except:
923+
pytest.skip("Skipping COM test; comtypes is not installed")
924+
return
925+
921926
DSS_COM = dss.patch_dss_com(comtypes.client.CreateObject("OpenDSSengine.DSS"))
922927
test_essentials(DSS_COM)
923928
else:
@@ -932,7 +937,12 @@ def test_patch_win32com():
932937
pytest.skip("Skipping COM test; OpenDSSDirect.DLL already loaded.")
933938
return
934939

935-
import win32com.client
940+
try:
941+
import win32com.client
942+
except:
943+
pytest.skip("Skipping COM test; win32com is not installed")
944+
return
945+
936946
win32com.client.Dispatch("OpenDSSengine.DSS")
937947
DSS_COM = dss.patch_dss_com(win32com.client.gencache.EnsureDispatch("OpenDSSengine.DSS"))
938948
test_essentials(DSS_COM)

0 commit comments

Comments
 (0)