File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Run tInstall in R2021a on Ubuntu against Python 3.8
2+
3+ name : Test R2021a
4+
5+ on :
6+ push :
7+ branches :
8+ - R2021a
9+
10+ pull_request :
11+ branches :
12+ - R2021a
13+
14+ # Allows you to run this workflow manually from the Actions tab
15+ workflow_dispatch :
16+
17+
18+
19+ # A workflow run is made up of one or more jobs that can run sequentially or in parallel
20+ jobs :
21+ test-python-engine :
22+ runs-on : ubuntu-latest
23+
24+ steps :
25+ - name : Set up Python
26+ uses : actions/setup-python@v3.1.3
27+ with :
28+ python-version : 3.8
29+
30+ - name : Set up MATLAB
31+ uses : matlab-actions/setup-matlab@v1
32+ with :
33+ release : R2021a
34+
35+ - uses : actions/checkout@v3
36+
37+ - name : Run tests
38+ uses : matlab-actions/run-tests@v1
Original file line number Diff line number Diff line change 1+ classdef tInstall < matlab .unittest .TestCase
2+ % Verify installation of matlab engine
3+
4+ % Copyright 2023 Mathworks, Inc.
5+
6+ properties (Constant )
7+ MATLABVersion = string(ver(' MATLAB' ).Version) % Example: 9.14
8+ end
9+
10+ methods (Test )
11+ function installMatchingEngine(testCase )
12+ [status , out ] = system(" pip install matlabengine==" + testCase .MATLABVersion + " .*" );
13+ addTeardown(testCase , @system , " pip uninstall -y matlabengine" )
14+ verifyEqual(testCase , status , 0 , out )
15+ verifyInstallation(testCase )
16+ end
17+ end
18+
19+ methods
20+ function verifyInstallation(testCase )
21+ % Verify installation by calling functions in matlab engine
22+ % Share this session and see if find_matlab can find it.
23+ sharedEngineName = matlab .engine .engineName ;
24+ if isempty(sharedEngineName )
25+ sharedEngineName = ' MATLAB_tInstall' ;
26+ matlab .engine .shareEngine(sharedEngineName )
27+ end
28+ pySharedEngineName = char(py .matlab .engine .find_matlab());
29+ verifySubstring(testCase , pySharedEngineName , sharedEngineName )
30+ end
31+ end
32+ end
You can’t perform that action at this time.
0 commit comments