Skip to content

Commit

Permalink
Coverage of new Matlab related functions
Browse files Browse the repository at this point in the history
  • Loading branch information
langmm committed Oct 29, 2018
1 parent 500fb93 commit 678c045
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cis_interface/drivers/MatlabModelDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
+ "Matlab support will be disabled.")
_matlab_installed = False
from cis_interface.drivers.ModelDriver import ModelDriver
from cis_interface import backwards, tools
from cis_interface import backwards, tools, platform
from cis_interface.tools import TimeOut, sleep
from cis_interface.schema import register_component

Expand All @@ -23,7 +23,10 @@

def kill_all():
r"""Kill all Matlab shared engines."""
os.system(('pkill -f matlab.engine.shareEngine'))
if platform._is_win: # pragma: windows
os.system(('taskkill /F /IM matlab.engine.shareEngine /T'))
else:
os.system(('pkill -f matlab.engine.shareEngine'))


def is_matlab_running():
Expand Down Expand Up @@ -119,7 +122,7 @@ def start_matlab(skip_connect=False): # pragma: matlab
return screen_session, matlab_engine, new_matlab


def connect_matlab(matlab_session, first_connect=False):
def connect_matlab(matlab_session, first_connect=False): # pragma: matlab
r"""Connect to Matlab engine.
Args:
Expand Down
2 changes: 2 additions & 0 deletions cis_interface/drivers/tests/test_MatlabModelDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
def test_is_matlab_running():
r"""Test if there is Matlab engine running."""
MatlabModelDriver.is_matlab_running()
MatlabModelDriver.kill_all()
assert(not MatlabModelDriver.is_matlab_running())


@unittest.skipIf(MatlabModelDriver._matlab_installed, "Matlab installed.")
Expand Down

0 comments on commit 678c045

Please sign in to comment.