matlab-proxy 0.23.4__py3-none-any.whl → 0.24.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of matlab-proxy might be problematic. Click here for more details.
- matlab_proxy/app_state.py +48 -29
- matlab_proxy/gui/index.html +20 -1
- matlab_proxy/gui/static/css/index.BSVLACuY.css +10 -0
- matlab_proxy/gui/static/js/index.c3NLxnRM.js +64 -0
- matlab_proxy/settings.py +136 -86
- matlab_proxy/util/mwi/embedded_connector/helpers.py +2 -2
- matlab_proxy/util/mwi/embedded_connector/request.py +1 -1
- matlab_proxy/util/mwi/logger.py +1 -2
- matlab_proxy/util/mwi/validators.py +19 -11
- {matlab_proxy-0.23.4.dist-info → matlab_proxy-0.24.2.dist-info}/METADATA +3 -3
- {matlab_proxy-0.23.4.dist-info → matlab_proxy-0.24.2.dist-info}/RECORD +42 -57
- matlab_proxy_manager/lib/api.py +21 -18
- matlab_proxy_manager/storage/server.py +26 -1
- tests/unit/conftest.py +1 -2
- tests/unit/test_app_state.py +30 -3
- tests/unit/test_settings.py +190 -11
- tests/unit/util/mwi/test_logger.py +1 -2
- tests/unit/util/mwi/test_validators.py +12 -7
- matlab_proxy/gui/asset-manifest.json +0 -44
- matlab_proxy/gui/static/css/main.efa05ff9.css +0 -13
- matlab_proxy/gui/static/css/main.efa05ff9.css.map +0 -1
- matlab_proxy/gui/static/js/main.ce0f5505.js +0 -3
- matlab_proxy/gui/static/js/main.ce0f5505.js.LICENSE.txt +0 -59
- matlab_proxy/gui/static/js/main.ce0f5505.js.map +0 -1
- matlab_proxy/gui/static/media/arrow.0c2968b90bd9a64c8c3f.svg +0 -4
- matlab_proxy/gui/static/media/feedback.6e8d50eb812cf35e0e76.svg +0 -1
- matlab_proxy/gui/static/media/gripper.9defbc5e76d0de8bb6e0.svg +0 -1
- matlab_proxy/gui/static/media/help.15e5bfab03a2b9c7148e.svg +0 -1
- matlab_proxy/gui/static/media/ico-header-contact-hover.0958c44200d781def822.svg +0 -17
- matlab_proxy/gui/static/media/ico-header-contact.ae9169c8dcae37c6e04b.svg +0 -17
- matlab_proxy/gui/static/media/restart.7987508a01e84678361a.svg +0 -1
- matlab_proxy/gui/static/media/sign-out.08356b675ec854afaa77.svg +0 -1
- matlab_proxy/gui/static/media/start.50c4596fab2049b4a3a3.svg +0 -1
- matlab_proxy/gui/static/media/stop.30c9a9ab6d625032235a.svg +0 -1
- matlab_proxy/gui/static/media/terminate.7ea1363ee0fa72344ef6.svg +0 -1
- /matlab_proxy/gui/static/media/{MATLAB-env-blur.4fc94edbc82d3184e5cb.png → MATLAB-env-blur.NupTbPv_.png} +0 -0
- /matlab_proxy/gui/static/media/{glyphicons-halflings-regular.82b1212e45a2bc35dd73.woff → glyphicons-halflings-regular.BKjkU69z.woff} +0 -0
- /matlab_proxy/gui/static/media/{glyphicons-halflings-regular.5be1347c682810f199c7.eot → glyphicons-halflings-regular.BUJKDMgK.eot} +0 -0
- /matlab_proxy/gui/static/media/{glyphicons-halflings-regular.060b2710bdbbe3dfe48b.svg → glyphicons-halflings-regular.CSehLiBc.svg} +0 -0
- /matlab_proxy/gui/static/media/{glyphicons-halflings-regular.4692b9ec53fd5972caa2.ttf → glyphicons-halflings-regular.DrwTMapi.ttf} +0 -0
- /matlab_proxy/gui/static/media/{glyphicons-halflings-regular.be810be3a3e14c682a25.woff2 → glyphicons-halflings-regular.DzqM6ju8.woff2} +0 -0
- /matlab_proxy/gui/static/media/{ico-header-account-hover.89438e91d0632893b106.svg → ico-header-account-hover.-jQHo6Wx.svg} +0 -0
- /matlab_proxy/gui/static/media/{ico-header-account.86b10d7b4a2a511f6ca9.svg → ico-header-account.CJCFoo5a.svg} +0 -0
- /matlab_proxy/gui/static/media/{ico-sprite.cbdb66c0ea4c2a7fd21c.png → ico-sprite.DXGLgzq9.png} +0 -0
- /matlab_proxy/gui/static/media/{mathworks-eps.4d20e0ee46ea74bccfc1.ttf → mathworks-eps.CGNQALa9.ttf} +0 -0
- /matlab_proxy/gui/static/media/{mathworks-eps.df1428dfa69cea896c05.svg → mathworks-eps.DrkCtQtG.svg} +0 -0
- /matlab_proxy/gui/static/media/{mathworks-eps.e5c41e8478df02cbdce1.woff → mathworks-eps.Ds7lQbql.woff} +0 -0
- /matlab_proxy/gui/static/media/{mathworks-pictograms.3fc6513a06dce552eeb1.woff → mathworks-pictograms.BdqxEfBR.woff} +0 -0
- /matlab_proxy/gui/static/media/{mathworks-pictograms.f6f087b008b5a9435f26.svg → mathworks-pictograms.CCLweoD4.svg} +0 -0
- /matlab_proxy/gui/static/media/{mathworks-pictograms.6e128c0e7fc1a11f92ee.ttf → mathworks-pictograms.DZhFdRSm.ttf} +0 -0
- /matlab_proxy/gui/static/media/{mathworks.80a3218e1ba29f0573fb.svg → mathworks.C-qsbhDy.svg} +0 -0
- /matlab_proxy/gui/static/media/{mathworks.c422935b9ae545ac2ab5.ttf → mathworks.Ceplx86V.ttf} +0 -0
- /matlab_proxy/gui/static/media/{mathworks.37a563ef6aeda1593bf6.woff → mathworks.D08X1Vp8.woff} +0 -0
- /matlab_proxy/gui/static/media/{trigger-error.3f1c4ef23ab8f3e60b0e.svg → trigger-error.QEdsGL-m.svg} +0 -0
- /matlab_proxy/gui/static/media/{trigger-ok.7b9c238be42f685c4fa7.svg → trigger-ok.Dzg8OIrk.svg} +0 -0
- {matlab_proxy-0.23.4.dist-info → matlab_proxy-0.24.2.dist-info}/LICENSE.md +0 -0
- {matlab_proxy-0.23.4.dist-info → matlab_proxy-0.24.2.dist-info}/WHEEL +0 -0
- {matlab_proxy-0.23.4.dist-info → matlab_proxy-0.24.2.dist-info}/entry_points.txt +0 -0
- {matlab_proxy-0.23.4.dist-info → matlab_proxy-0.24.2.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
# Copyright 2024 The MathWorks, Inc.
|
|
1
|
+
# Copyright 2024-2025 The MathWorks, Inc.
|
|
2
2
|
import json
|
|
3
3
|
from dataclasses import asdict, dataclass, field
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from typing import Optional
|
|
6
6
|
|
|
7
|
+
import psutil
|
|
8
|
+
|
|
7
9
|
from matlab_proxy_manager.utils import helpers, logger
|
|
8
10
|
|
|
9
11
|
log = logger.get()
|
|
@@ -96,8 +98,31 @@ class ServerProcess:
|
|
|
96
98
|
return shutdown_resp
|
|
97
99
|
except Exception as e:
|
|
98
100
|
log.debug("Exception while shutting down matlab proxy: %s", e)
|
|
101
|
+
|
|
102
|
+
# Force kill matlab-proxy and its process tree if termination
|
|
103
|
+
# via shutdown_integration endpoint fails
|
|
104
|
+
matlab_proxy_process = psutil.Process(int(self.pid))
|
|
105
|
+
self.terminate_process_tree(matlab_proxy_process)
|
|
99
106
|
return None
|
|
100
107
|
|
|
108
|
+
def terminate_process_tree(self, matlab_proxy_process):
|
|
109
|
+
"""
|
|
110
|
+
Terminates the process tree of the MATLAB proxy server.
|
|
111
|
+
|
|
112
|
+
This method terminates all child processes of the MATLAB proxy process,
|
|
113
|
+
waits for a short period, and then forcefully kills any remaining processes.
|
|
114
|
+
Finally, it kills the main MATLAB proxy process itself.
|
|
115
|
+
"""
|
|
116
|
+
matlab_proxy_child_processes = matlab_proxy_process.children(recursive=True)
|
|
117
|
+
for child_process in matlab_proxy_child_processes:
|
|
118
|
+
child_process.terminate()
|
|
119
|
+
_, alive = psutil.wait_procs(matlab_proxy_child_processes, timeout=5)
|
|
120
|
+
for process in alive:
|
|
121
|
+
# Kill the processes which are alive even after waiting for 5 seconds
|
|
122
|
+
process.kill()
|
|
123
|
+
matlab_proxy_process.kill()
|
|
124
|
+
log.debug("Killed matlab-proxy process with PID: %s", self.pid)
|
|
125
|
+
|
|
101
126
|
def is_server_alive(self) -> bool:
|
|
102
127
|
"""
|
|
103
128
|
Checks if the server process is alive and ready.
|
tests/unit/conftest.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Copyright 2020-2022 The MathWorks, Inc.
|
|
2
2
|
|
|
3
|
-
"""
|
|
4
|
-
"""
|
|
3
|
+
"""The conftest.py file is run by the pytest framework for setting things up for the test session."""
|
|
5
4
|
|
|
6
5
|
import os
|
|
7
6
|
import shutil
|
tests/unit/test_app_state.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2023-
|
|
1
|
+
# Copyright 2023-2025 The MathWorks, Inc.
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import json
|
|
@@ -13,7 +13,11 @@ from matlab_proxy import settings
|
|
|
13
13
|
from matlab_proxy import settings
|
|
14
14
|
from matlab_proxy.app_state import AppState
|
|
15
15
|
from matlab_proxy.constants import MWI_AUTH_TOKEN_NAME_FOR_HTTP
|
|
16
|
-
from matlab_proxy.util.mwi.exceptions import
|
|
16
|
+
from matlab_proxy.util.mwi.exceptions import (
|
|
17
|
+
LicensingError,
|
|
18
|
+
MatlabError,
|
|
19
|
+
MatlabInstallError,
|
|
20
|
+
)
|
|
17
21
|
from matlab_proxy.constants import (
|
|
18
22
|
CONNECTOR_SECUREPORT_FILENAME,
|
|
19
23
|
USER_CODE_OUTPUT_FILE_NAME,
|
|
@@ -415,7 +419,7 @@ async def test_track_embedded_connector_posix(
|
|
|
415
419
|
spy.assert_called_once()
|
|
416
420
|
|
|
417
421
|
|
|
418
|
-
@pytest.mark.parametrize("platform", [
|
|
422
|
+
@pytest.mark.parametrize("platform", ["windows"])
|
|
419
423
|
async def test_track_embedded_connector(mocker_os_patching_fixture, app_state_fixture):
|
|
420
424
|
"""Test to check track_embedded_connector task on windows.
|
|
421
425
|
|
|
@@ -611,6 +615,29 @@ async def test_start_matlab_without_xvfb(app_state_fixture, mocker):
|
|
|
611
615
|
assert app_state_fixture.processes["matlab"] is mock_matlab
|
|
612
616
|
|
|
613
617
|
|
|
618
|
+
async def test_start_matlab_without_xvfb_and_matlab(app_state_fixture):
|
|
619
|
+
"""Test to check if MATLAB doesn't start and sets the error variable to MatlabInstallError when
|
|
620
|
+
there is not MATLAB on system PATH
|
|
621
|
+
|
|
622
|
+
Args:
|
|
623
|
+
app_state_fixture (AppState): Object of AppState class with defaults set
|
|
624
|
+
"""
|
|
625
|
+
# Arrange
|
|
626
|
+
app_state_fixture.settings["is_xvfb_available"] = False
|
|
627
|
+
app_state_fixture.settings["matlab_cmd"] = None
|
|
628
|
+
|
|
629
|
+
# Act
|
|
630
|
+
await app_state_fixture.start_matlab()
|
|
631
|
+
|
|
632
|
+
# Assert
|
|
633
|
+
# Check if Xvfb has not started
|
|
634
|
+
assert app_state_fixture.processes["xvfb"] is None
|
|
635
|
+
# Check if Matlab has not started
|
|
636
|
+
assert app_state_fixture.processes["matlab"] is None
|
|
637
|
+
# Check if MatlabInstallError is set as the error
|
|
638
|
+
assert isinstance(app_state_fixture.error, MatlabInstallError)
|
|
639
|
+
|
|
640
|
+
|
|
614
641
|
@pytest.mark.parametrize(
|
|
615
642
|
"is_desktop, client_id, is_client_id_present, expected_is_active_client",
|
|
616
643
|
[
|
tests/unit/test_settings.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# Copyright 2020-
|
|
1
|
+
# Copyright 2020-2025 The MathWorks, Inc.
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
|
-
import ssl
|
|
5
4
|
import time
|
|
6
5
|
import tempfile
|
|
6
|
+
import platform
|
|
7
7
|
|
|
8
8
|
import matlab_proxy
|
|
9
9
|
import matlab_proxy.settings as settings
|
|
@@ -467,29 +467,208 @@ def test_get_ssl_context_with_invalid_custom_ssl_files_raises_exception(
|
|
|
467
467
|
)
|
|
468
468
|
def test_get_matlab_settings_custom_code(
|
|
469
469
|
monkeypatch,
|
|
470
|
-
mocker,
|
|
471
470
|
expected_value_for_has_custom_code,
|
|
472
471
|
custom_code,
|
|
473
472
|
has_custom_code_exception_matlab_cmd,
|
|
474
473
|
):
|
|
475
474
|
# Arrange
|
|
476
475
|
monkeypatch.setenv(mwi_env.get_env_name_custom_matlab_code(), custom_code)
|
|
476
|
+
|
|
477
|
+
# Act
|
|
478
|
+
has_custom_code, code_to_execute = settings._get_matlab_code_to_execute()
|
|
479
|
+
exception_present_in_matlab_cmd = "MATLABCustomStartupCodeError" in code_to_execute
|
|
480
|
+
|
|
481
|
+
# Assert
|
|
482
|
+
assert has_custom_code == expected_value_for_has_custom_code
|
|
483
|
+
assert exception_present_in_matlab_cmd == has_custom_code_exception_matlab_cmd
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
def test_get_nlm_conn_str(monkeypatch):
|
|
487
|
+
# Arrange
|
|
488
|
+
test_nlm_str = "123@license_server_address"
|
|
489
|
+
monkeypatch.setenv(mwi_env.get_env_name_network_license_manager(), test_nlm_str)
|
|
490
|
+
|
|
491
|
+
# Act
|
|
492
|
+
nlm_conn_str = settings._get_nlm_conn_str()
|
|
493
|
+
|
|
494
|
+
# Assert
|
|
495
|
+
assert nlm_conn_str == test_nlm_str
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
@pytest.mark.parametrize("ws_env_suffix", ["", "-dev", "-test"])
|
|
499
|
+
def test_get_mw_licensing_urls(ws_env_suffix):
|
|
500
|
+
# Act
|
|
501
|
+
urls = settings._get_mw_licensing_urls(ws_env_suffix)
|
|
502
|
+
|
|
503
|
+
# Assert
|
|
504
|
+
assert all(ws_env_suffix in url for url in urls.values())
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
@pytest.mark.parametrize("nlm_conn_str", [None, "1234@testserver"])
|
|
508
|
+
def test_get_matlab_cmd_posix(nlm_conn_str, mocker):
|
|
509
|
+
# Arrange
|
|
510
|
+
matlab_executable_path = "/path/to/matlab"
|
|
511
|
+
code_to_execute = "disp('Test')"
|
|
512
|
+
mocker.patch("matlab_proxy.settings.system.is_windows", return_value=False)
|
|
513
|
+
|
|
514
|
+
# Act
|
|
515
|
+
cmd = settings._get_matlab_cmd(
|
|
516
|
+
matlab_executable_path, code_to_execute, nlm_conn_str
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
# Assert
|
|
520
|
+
assert cmd[0] == matlab_executable_path
|
|
521
|
+
assert "-noDisplayDesktop" not in cmd
|
|
522
|
+
|
|
523
|
+
if nlm_conn_str:
|
|
524
|
+
assert "-licmode" in cmd
|
|
525
|
+
assert "file" in cmd
|
|
526
|
+
else:
|
|
527
|
+
assert "-licmode" not in cmd
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
def test_get_matlab_cmd_windows(mocker):
|
|
531
|
+
# Arrange
|
|
532
|
+
matlab_executable_path = "C:\\path\\to\\matlab.exe"
|
|
533
|
+
code_to_execute = "disp('Test')"
|
|
534
|
+
mocker.patch("matlab_proxy.settings.system.is_windows", return_value=True)
|
|
535
|
+
|
|
536
|
+
# Act
|
|
537
|
+
cmd = settings._get_matlab_cmd(matlab_executable_path, code_to_execute, None)
|
|
538
|
+
|
|
539
|
+
# Assert
|
|
540
|
+
assert "-noDisplayDesktop" in cmd
|
|
541
|
+
assert "-wait" in cmd
|
|
542
|
+
assert "-log" in cmd
|
|
543
|
+
assert ".exe" in cmd[0] # Assert .exe suffix in matlab_executable_path
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
def test_get_matlab_cmd_with_mpa_flags(mocker):
|
|
547
|
+
# Arrange
|
|
477
548
|
mocker.patch(
|
|
478
|
-
"matlab_proxy.settings.
|
|
479
|
-
return_value=("matlab", None),
|
|
549
|
+
"matlab_proxy.settings.mwi_env.Experimental.is_mpa_enabled", return_value=True
|
|
480
550
|
)
|
|
551
|
+
matlab_executable_path = "/path/to/matlab"
|
|
552
|
+
code_to_execute = "disp('Test')"
|
|
553
|
+
|
|
554
|
+
# Act
|
|
555
|
+
cmd = settings._get_matlab_cmd(matlab_executable_path, code_to_execute, None)
|
|
556
|
+
|
|
557
|
+
# Assert
|
|
558
|
+
assert all(mpa_flag in cmd for mpa_flag in mwi_env.Experimental.get_mpa_flags())
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
def test_get_matlab_cmd_with_startup_profiling(mocker):
|
|
562
|
+
# Arrange
|
|
563
|
+
mocker.patch("matlab_proxy.settings.system.is_windows", return_value=False)
|
|
564
|
+
mocker.patch(
|
|
565
|
+
"matlab_proxy.settings.mwi_env.Experimental.is_matlab_startup_profiling_enabled",
|
|
566
|
+
return_value=True,
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
matlab_executable_path = "/path/to/matlab"
|
|
570
|
+
code_to_execute = "disp('Test')"
|
|
571
|
+
|
|
572
|
+
# Act
|
|
573
|
+
cmd = settings._get_matlab_cmd(matlab_executable_path, code_to_execute, None)
|
|
574
|
+
|
|
575
|
+
# Assert
|
|
576
|
+
assert "-timing" in cmd
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
def test_get_matlab_settings_no_matlab_on_path(mocker):
|
|
580
|
+
# Arrange
|
|
581
|
+
mocker.patch("matlab_proxy.settings.shutil.which", return_value=None)
|
|
481
582
|
|
|
482
583
|
# Act
|
|
483
584
|
matlab_settings = settings.get_matlab_settings()
|
|
484
|
-
|
|
485
|
-
|
|
585
|
+
|
|
586
|
+
# Assert
|
|
587
|
+
assert isinstance(matlab_settings["error"], MatlabInstallError)
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
def test_get_matlab_settings_matlab_softlink(mocker, tmp_path):
|
|
591
|
+
# Arrange
|
|
592
|
+
matlab_root_path = Path(tmp_path)
|
|
593
|
+
matlab_exec_path = matlab_root_path / "bin" / "matlab"
|
|
594
|
+
mocker.patch("matlab_proxy.settings.shutil.which", return_value=matlab_exec_path)
|
|
595
|
+
mocker.patch(
|
|
596
|
+
"matlab_proxy.settings.mwi.validators.validate_matlab_root_path",
|
|
597
|
+
return_value=matlab_root_path,
|
|
486
598
|
)
|
|
487
|
-
|
|
599
|
+
|
|
600
|
+
# Act
|
|
601
|
+
matlab_settings = settings.get_matlab_settings()
|
|
602
|
+
|
|
603
|
+
# Assert
|
|
604
|
+
assert str(matlab_exec_path) in str(matlab_settings["matlab_cmd"][0])
|
|
605
|
+
assert matlab_settings["matlab_path"] == matlab_root_path
|
|
606
|
+
assert (
|
|
607
|
+
matlab_settings["matlab_version"] is None
|
|
608
|
+
) # There's no VersionInfo.xml file in the mock setup
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
def test_get_matlab_settings_matlab_wrapper(mocker, tmp_path):
|
|
612
|
+
# Arrange
|
|
613
|
+
matlab_exec_path = Path(tmp_path) / "matlab"
|
|
614
|
+
mocker.patch("matlab_proxy.settings.shutil.which", return_value=matlab_exec_path)
|
|
615
|
+
|
|
616
|
+
# Act
|
|
617
|
+
matlab_settings = settings.get_matlab_settings()
|
|
488
618
|
|
|
489
619
|
# Assert
|
|
620
|
+
assert str(matlab_exec_path) in str(matlab_settings["matlab_cmd"][0])
|
|
621
|
+
assert (
|
|
622
|
+
matlab_settings["matlab_path"] is None
|
|
623
|
+
) # Matlab root could not be determined because wrapper script is being used
|
|
624
|
+
assert matlab_settings["matlab_version"] is None
|
|
490
625
|
assert (
|
|
491
|
-
matlab_settings["
|
|
492
|
-
|
|
626
|
+
matlab_settings["error"] is None
|
|
627
|
+
) # Error has to be None when matlab executable is on PATH but root path could not be determined
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
def test_get_matlab_settings_valid_custom_matlab_root(mocker, monkeypatch, tmp_path):
|
|
631
|
+
# Arrange
|
|
632
|
+
matlab_root_path = Path(tmp_path)
|
|
633
|
+
matlab_exec_path = matlab_root_path / "bin" / "matlab"
|
|
634
|
+
matlab_version = "R2024b"
|
|
635
|
+
monkeypatch.setenv(mwi_env.get_env_name_custom_matlab_root(), str(matlab_root_path))
|
|
636
|
+
mocker.patch(
|
|
637
|
+
"matlab_proxy.settings.mwi.validators.validate_matlab_root_path",
|
|
638
|
+
return_value=matlab_root_path,
|
|
639
|
+
)
|
|
640
|
+
mocker.patch(
|
|
641
|
+
"matlab_proxy.settings.get_matlab_version", return_value=matlab_version
|
|
493
642
|
)
|
|
494
643
|
|
|
495
|
-
|
|
644
|
+
# Act
|
|
645
|
+
matlab_settings = settings.get_matlab_settings()
|
|
646
|
+
|
|
647
|
+
# Assert
|
|
648
|
+
assert str(matlab_exec_path) in str(matlab_settings["matlab_cmd"][0])
|
|
649
|
+
assert matlab_settings["matlab_path"] == matlab_root_path
|
|
650
|
+
assert matlab_settings["matlab_version"] == matlab_version
|
|
651
|
+
assert matlab_settings["error"] is None
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
def test_get_matlab_settings_invalid_custom_matlab_root(mocker, monkeypatch, tmp_path):
|
|
655
|
+
# Arrange
|
|
656
|
+
matlab_root_path = Path(tmp_path)
|
|
657
|
+
monkeypatch.setenv(mwi_env.get_env_name_custom_matlab_root(), str(matlab_root_path))
|
|
658
|
+
|
|
659
|
+
# Act
|
|
660
|
+
matlab_settings = settings.get_matlab_settings()
|
|
661
|
+
|
|
662
|
+
# Assert
|
|
663
|
+
# When custom MATLAB root is supplied, it must be the actual MATLAB root ie.
|
|
664
|
+
# VersionInfo.xml file must to be there
|
|
665
|
+
# matlab executable inside the bin folder must be there
|
|
666
|
+
# If not, MATLAB related settings should be None and custom MATLAB root error should be present
|
|
667
|
+
assert matlab_settings["matlab_cmd"] is None
|
|
668
|
+
assert matlab_settings["matlab_path"] is None
|
|
669
|
+
assert matlab_settings["matlab_version"] is None
|
|
670
|
+
assert (
|
|
671
|
+
isinstance(matlab_settings["error"], MatlabInstallError)
|
|
672
|
+
and mwi_env.get_env_name_custom_matlab_root()
|
|
673
|
+
in matlab_settings["error"].message
|
|
674
|
+
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2020-
|
|
1
|
+
# Copyright 2020-2025 The MathWorks, Inc.
|
|
2
2
|
|
|
3
3
|
"""Tests for functions in matlab_proxy/util/mwi_validators.py"""
|
|
4
4
|
|
|
@@ -295,7 +295,7 @@ def test_validate_matlab_root_path(tmp_path):
|
|
|
295
295
|
assert actual_matlab_root_custom == matlab_root
|
|
296
296
|
|
|
297
297
|
|
|
298
|
-
def
|
|
298
|
+
def test_validate_matlab_root_path_non_existent_root_path(tmp_path):
|
|
299
299
|
"""Checks if validate_matlab_root_path raises MatlabInstallError when non-existent path is supplied"""
|
|
300
300
|
# Arrange
|
|
301
301
|
matlab_root = Path(tmp_path) / "MATLAB"
|
|
@@ -315,22 +315,27 @@ def test_validate_matlab_root_path_invalid_root_path(tmp_path):
|
|
|
315
315
|
|
|
316
316
|
|
|
317
317
|
def test_validate_matlab_root_path_non_existent_versioninfo_file(tmp_path):
|
|
318
|
-
"""Checks if validate_matlab_root_path does not raise any exceptions even if VersionInfo.xml file does not exist
|
|
318
|
+
"""Checks if validate_matlab_root_path does not raise any exceptions even if VersionInfo.xml file does not exist
|
|
319
|
+
when matlab wrapper is used and raises an exception when custom matlab root is used.
|
|
320
|
+
"""
|
|
319
321
|
# Arrange
|
|
320
322
|
matlab_root = Path(tmp_path) / "MATLAB"
|
|
321
323
|
os.mkdir(matlab_root)
|
|
322
324
|
|
|
323
325
|
# Act
|
|
326
|
+
# Location of VersionInfo.xml can't be determined with matlab wrapper script
|
|
327
|
+
# and error should not be raised
|
|
324
328
|
actual_matlab_root = validate_matlab_root_path(
|
|
325
329
|
matlab_root, is_custom_matlab_root=False
|
|
326
330
|
)
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
331
|
+
|
|
332
|
+
# Location of VersionInfo.xml must be determinable when custom MATLAB root is supplied.
|
|
333
|
+
# If not, an exception must be raised
|
|
334
|
+
with pytest.raises(MatlabInstallError):
|
|
335
|
+
validate_matlab_root_path(matlab_root, is_custom_matlab_root=True)
|
|
330
336
|
|
|
331
337
|
# Assert
|
|
332
338
|
assert actual_matlab_root is None
|
|
333
|
-
assert actual_matlab_root_custom is None
|
|
334
339
|
|
|
335
340
|
|
|
336
341
|
@pytest.mark.parametrize(
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"files": {
|
|
3
|
-
"main.css": "./static/css/main.efa05ff9.css",
|
|
4
|
-
"main.js": "./static/js/main.ce0f5505.js",
|
|
5
|
-
"static/media/mathworks-pictograms.svg?20181009": "./static/media/mathworks-pictograms.f6f087b008b5a9435f26.svg",
|
|
6
|
-
"static/media/MATLAB-env-blur.png": "./static/media/MATLAB-env-blur.4fc94edbc82d3184e5cb.png",
|
|
7
|
-
"static/media/mathworks.svg?20181004": "./static/media/mathworks.80a3218e1ba29f0573fb.svg",
|
|
8
|
-
"static/media/glyphicons-halflings-regular.svg": "./static/media/glyphicons-halflings-regular.060b2710bdbbe3dfe48b.svg",
|
|
9
|
-
"static/media/mathworks-pictograms.woff?20181009": "./static/media/mathworks-pictograms.3fc6513a06dce552eeb1.woff",
|
|
10
|
-
"static/media/mathworks-pictograms.ttf?20181009": "./static/media/mathworks-pictograms.6e128c0e7fc1a11f92ee.ttf",
|
|
11
|
-
"static/media/glyphicons-halflings-regular.ttf": "./static/media/glyphicons-halflings-regular.4692b9ec53fd5972caa2.ttf",
|
|
12
|
-
"static/media/mathworks.woff?20181004": "./static/media/mathworks.37a563ef6aeda1593bf6.woff",
|
|
13
|
-
"static/media/mathworks.ttf?20181004": "./static/media/mathworks.c422935b9ae545ac2ab5.ttf",
|
|
14
|
-
"static/media/glyphicons-halflings-regular.woff": "./static/media/glyphicons-halflings-regular.82b1212e45a2bc35dd73.woff",
|
|
15
|
-
"static/media/glyphicons-halflings-regular.eot": "./static/media/glyphicons-halflings-regular.5be1347c682810f199c7.eot",
|
|
16
|
-
"static/media/glyphicons-halflings-regular.woff2": "./static/media/glyphicons-halflings-regular.be810be3a3e14c682a25.woff2",
|
|
17
|
-
"static/media/mathworks-eps.svg?20181004": "./static/media/mathworks-eps.df1428dfa69cea896c05.svg",
|
|
18
|
-
"static/media/ico-sprite.png": "./static/media/ico-sprite.cbdb66c0ea4c2a7fd21c.png",
|
|
19
|
-
"static/media/mathworks-eps.woff?20181004": "./static/media/mathworks-eps.e5c41e8478df02cbdce1.woff",
|
|
20
|
-
"static/media/mathworks-eps.ttf?20181004": "./static/media/mathworks-eps.4d20e0ee46ea74bccfc1.ttf",
|
|
21
|
-
"static/media/trigger-error.svg": "./static/media/trigger-error.3f1c4ef23ab8f3e60b0e.svg",
|
|
22
|
-
"static/media/trigger-ok.svg": "./static/media/trigger-ok.7b9c238be42f685c4fa7.svg",
|
|
23
|
-
"static/media/ico-header-account-hover.svg": "./static/media/ico-header-account-hover.89438e91d0632893b106.svg",
|
|
24
|
-
"static/media/ico-header-account.svg": "./static/media/ico-header-account.86b10d7b4a2a511f6ca9.svg",
|
|
25
|
-
"static/media/feedback.svg": "./static/media/feedback.6e8d50eb812cf35e0e76.svg",
|
|
26
|
-
"static/media/terminate.svg": "./static/media/terminate.7ea1363ee0fa72344ef6.svg",
|
|
27
|
-
"static/media/help.svg": "./static/media/help.15e5bfab03a2b9c7148e.svg",
|
|
28
|
-
"static/media/ico-header-contact-hover.svg": "./static/media/ico-header-contact-hover.0958c44200d781def822.svg",
|
|
29
|
-
"static/media/ico-header-contact.svg": "./static/media/ico-header-contact.ae9169c8dcae37c6e04b.svg",
|
|
30
|
-
"static/media/restart.svg": "./static/media/restart.7987508a01e84678361a.svg",
|
|
31
|
-
"static/media/stop.svg": "./static/media/stop.30c9a9ab6d625032235a.svg",
|
|
32
|
-
"static/media/sign-out.svg": "./static/media/sign-out.08356b675ec854afaa77.svg",
|
|
33
|
-
"static/media/start.svg": "./static/media/start.50c4596fab2049b4a3a3.svg",
|
|
34
|
-
"index.html": "./index.html",
|
|
35
|
-
"static/media/gripper.svg": "./static/media/gripper.9defbc5e76d0de8bb6e0.svg",
|
|
36
|
-
"static/media/arrow.svg": "./static/media/arrow.0c2968b90bd9a64c8c3f.svg",
|
|
37
|
-
"main.efa05ff9.css.map": "./static/css/main.efa05ff9.css.map",
|
|
38
|
-
"main.ce0f5505.js.map": "./static/js/main.ce0f5505.js.map"
|
|
39
|
-
},
|
|
40
|
-
"entrypoints": [
|
|
41
|
-
"static/css/main.efa05ff9.css",
|
|
42
|
-
"static/js/main.ce0f5505.js"
|
|
43
|
-
]
|
|
44
|
-
}
|