Skip to content

Commit 6bdb908

Browse files
committed
Merge branch 'R2022b' of https://github.com/mathworks/matlab-engine-for-python into R2022b
2 parents e10d8e2 + 5be0bd9 commit 6bdb908

3 files changed

Lines changed: 83 additions & 1 deletion

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Run tInstall on Ubuntu against python versions 3.10, 3.9 and 3.8
2+
3+
name: Test R2022b and R2023a
4+
5+
on:
6+
push:
7+
branches:
8+
- R2022b
9+
- R2023a
10+
- main
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
16+
17+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
18+
jobs:
19+
test-python-engine:
20+
strategy:
21+
matrix:
22+
python: ["3.10", "3.9", "3.8"]
23+
matlab: [R2022b, R2023a]
24+
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Set up Python
29+
uses: actions/setup-python@v3.1.3
30+
with:
31+
python-version: ${{ matrix.python }}
32+
33+
- name: Set up MATLAB
34+
uses: matlab-actions/setup-matlab@v1
35+
with:
36+
release: ${{ matrix.matlab }}
37+
38+
- uses: actions/checkout@v3
39+
40+
- name: Run tests
41+
uses: matlab-actions/run-tests@v1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The MATLAB® Engine API for Python® provides a package to integrate MATLA
1111
### Required 3rd Party Products
1212
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
1313
* Python 3.8, 3.9, or 3.10
14-
* Supported Python versions by MATLAB release can be found [here](https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/python-compatibility.pdf).
14+
* Supported Python versions by MATLAB release can be found [here](https://www.mathworks.com/learn/training/advanced-matlab-application-development.html).
1515

1616
---
1717

test/tInstall.m

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
MATLABRelease = erase(ver('MATLAB').Release,{'(',')'}) % Example: (R2023a) -> R2023a
9+
end
10+
11+
methods (Test)
12+
function installNoVersionSpecified(testCase)
13+
assumeEqual(testCase, testCase.MATLABRelease, 'R2023a')
14+
[status, out] = system("pip install matlabengine");
15+
verifyEqual(testCase, status, 0, out)
16+
verifyInstallation(testCase)
17+
end
18+
19+
function installMatchingEngine(testCase)
20+
[status, out] = system("pip install matlabengine==" + testCase.MATLABVersion + ".*");
21+
verifyEqual(testCase, status, 0, out)
22+
verifyInstallation(testCase)
23+
end
24+
end
25+
26+
methods
27+
function verifyInstallation(testCase)
28+
% Verify installation by calling functions in matlab engine
29+
% Share this session and see if find_matlab can find it.
30+
sharedEngineName = string(matlab.engine.engineName);
31+
if (sharedEngineName == "")
32+
sharedEngineName = "MATLAB_tInstall";
33+
matlab.engine.shareEngine(sharedEngineName)
34+
end
35+
pySharedEngineName = string(py.matlab.engine.find_matlab());
36+
verifyEqual(testCase, pySharedEngineName, sharedEngineName)
37+
system("pip uninstall -y matlabengine")
38+
end
39+
end
40+
end
41+

0 commit comments

Comments
 (0)