matlab-proxy 0.24.2__py3-none-any.whl → 0.25.0__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.py +1 -3
- matlab_proxy/app_state.py +39 -13
- matlab_proxy/constants.py +2 -1
- matlab_proxy/gui/index.html +1 -1
- matlab_proxy/gui/static/js/index.qK3VCGVb.js +64 -0
- matlab_proxy/matlab/startup.m +1 -4
- matlab_proxy/settings.py +15 -11
- matlab_proxy/util/mwi/environment_variables.py +2 -27
- matlab_proxy/util/mwi/exceptions.py +14 -1
- {matlab_proxy-0.24.2.dist-info → matlab_proxy-0.25.0.dist-info}/METADATA +31 -19
- {matlab_proxy-0.24.2.dist-info → matlab_proxy-0.25.0.dist-info}/RECORD +23 -23
- {matlab_proxy-0.24.2.dist-info → matlab_proxy-0.25.0.dist-info}/WHEEL +1 -1
- {matlab_proxy-0.24.2.dist-info → matlab_proxy-0.25.0.dist-info}/entry_points.txt +0 -1
- tests/integration/integration_tests_with_license/test_http_end_points.py +4 -5
- tests/unit/test_app.py +94 -45
- tests/unit/test_app_state.py +8 -7
- tests/unit/test_non_dev_mode.py +4 -4
- tests/unit/test_settings.py +0 -15
- tests/unit/util/mwi/test_token_auth.py +5 -5
- tests/unit/util/test_mw.py +2 -2
- tests/unit/util/test_util.py +7 -7
- matlab_proxy/gui/static/js/index.c3NLxnRM.js +0 -64
- {matlab_proxy-0.24.2.dist-info → matlab_proxy-0.25.0.dist-info}/LICENSE.md +0 -0
- {matlab_proxy-0.24.2.dist-info → matlab_proxy-0.25.0.dist-info}/top_level.txt +0 -0
tests/unit/test_app_state.py
CHANGED
|
@@ -43,6 +43,7 @@ def sample_settings_fixture(tmp_path):
|
|
|
43
43
|
"warnings": [],
|
|
44
44
|
"matlab_config_file": tmp_file,
|
|
45
45
|
"is_xvfb_available": True,
|
|
46
|
+
"is_windowmanager_available": True,
|
|
46
47
|
"mwi_server_url": "dummy",
|
|
47
48
|
"mwi_logs_root_dir": Path(settings.get_mwi_config_folder(dev=True)),
|
|
48
49
|
"app_port": 12345,
|
|
@@ -55,12 +56,12 @@ def sample_settings_fixture(tmp_path):
|
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
@pytest.fixture
|
|
58
|
-
def app_state_fixture(sample_settings_fixture,
|
|
59
|
+
def app_state_fixture(sample_settings_fixture, event_loop):
|
|
59
60
|
"""A pytest fixture which returns an instance of AppState class with no errors.
|
|
60
61
|
|
|
61
62
|
Args:
|
|
62
63
|
sample_settings_fixture (dict): A dictionary of sample settings to be used by
|
|
63
|
-
|
|
64
|
+
event_loop : A pytest builtin fixture
|
|
64
65
|
|
|
65
66
|
Returns:
|
|
66
67
|
AppState: An object of the AppState class
|
|
@@ -71,7 +72,7 @@ def app_state_fixture(sample_settings_fixture, loop):
|
|
|
71
72
|
|
|
72
73
|
yield app_state
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
event_loop.run_until_complete(app_state.stop_server_tasks())
|
|
75
76
|
|
|
76
77
|
|
|
77
78
|
@pytest.fixture
|
|
@@ -108,13 +109,13 @@ def app_state_with_token_auth_fixture(
|
|
|
108
109
|
|
|
109
110
|
|
|
110
111
|
@pytest.fixture
|
|
111
|
-
def mocker_os_patching_fixture(mocker, platform,
|
|
112
|
+
def mocker_os_patching_fixture(mocker, platform, event_loop):
|
|
112
113
|
"""A pytest fixture which patches the is_* functions in system.py module
|
|
113
114
|
|
|
114
115
|
Args:
|
|
115
116
|
mocker : Built in pytest fixture
|
|
116
117
|
platform (str): A string representing "windows", "linux" or "mac"
|
|
117
|
-
|
|
118
|
+
event_loop : A pytest builtin fixture
|
|
118
119
|
|
|
119
120
|
Returns:
|
|
120
121
|
mocker: Built in pytest fixture with patched calls to system.py module.
|
|
@@ -123,7 +124,7 @@ def mocker_os_patching_fixture(mocker, platform, loop):
|
|
|
123
124
|
mocker.patch("matlab_proxy.app_state.system.is_windows", return_value=False)
|
|
124
125
|
mocker.patch("matlab_proxy.app_state.system.is_mac", return_value=False)
|
|
125
126
|
mocker.patch("matlab_proxy.app_state.system.is_posix", return_value=False)
|
|
126
|
-
mocker.patch("matlab_proxy.app_state.util.get_event_loop", return_value=
|
|
127
|
+
mocker.patch("matlab_proxy.app_state.util.get_event_loop", return_value=event_loop)
|
|
127
128
|
|
|
128
129
|
if platform == "linux":
|
|
129
130
|
mocker.patch("matlab_proxy.app_state.system.is_linux", return_value=True)
|
|
@@ -820,7 +821,7 @@ async def test_decrement_timer_runs_out(sample_settings_fixture, mocker):
|
|
|
820
821
|
app_state.processes = {"matlab": None, "xvfb": None}
|
|
821
822
|
app_state.licensing = {"type": "existing_license"}
|
|
822
823
|
|
|
823
|
-
# mock util.get_event_loop() to return a new
|
|
824
|
+
# mock util.get_event_loop() to return a new event_loop for the test to assert
|
|
824
825
|
mock_loop = asyncio.new_event_loop()
|
|
825
826
|
mocker.patch("matlab_proxy.app_state.util.get_event_loop", return_value=mock_loop)
|
|
826
827
|
|
tests/unit/test_non_dev_mode.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2020-
|
|
1
|
+
# Copyright 2020-2025 The MathWorks, Inc.
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
import shutil
|
|
@@ -126,7 +126,7 @@ def mock_settings_get_fixture(mocker):
|
|
|
126
126
|
|
|
127
127
|
@pytest.fixture(name="test_server")
|
|
128
128
|
def test_server_fixture(
|
|
129
|
-
|
|
129
|
+
event_loop,
|
|
130
130
|
aiohttp_client,
|
|
131
131
|
build_frontend,
|
|
132
132
|
matlab_port_setup,
|
|
@@ -140,7 +140,7 @@ def test_server_fixture(
|
|
|
140
140
|
This fixture 'initializes' the test server with different constraints from the test server in test_app.py
|
|
141
141
|
|
|
142
142
|
Args:
|
|
143
|
-
|
|
143
|
+
event_loop : Event loop
|
|
144
144
|
aiohttp_client : A built-in pytest fixture
|
|
145
145
|
build_frontend: Pytest fixture which generates the directory structure of static files with some placeholder content
|
|
146
146
|
matlab_port_setup: Pytest fixture which monkeypatches 'MWI_DEV' env to False. This is required for the test_server to add static content
|
|
@@ -150,7 +150,7 @@ def test_server_fixture(
|
|
|
150
150
|
[aiohttp_client]: A aiohttp_client to send HTTP requests.
|
|
151
151
|
"""
|
|
152
152
|
|
|
153
|
-
with FakeServer(
|
|
153
|
+
with FakeServer(event_loop, aiohttp_client) as test_server:
|
|
154
154
|
yield test_server
|
|
155
155
|
|
|
156
156
|
|
tests/unit/test_settings.py
CHANGED
|
@@ -543,21 +543,6 @@ def test_get_matlab_cmd_windows(mocker):
|
|
|
543
543
|
assert ".exe" in cmd[0] # Assert .exe suffix in matlab_executable_path
|
|
544
544
|
|
|
545
545
|
|
|
546
|
-
def test_get_matlab_cmd_with_mpa_flags(mocker):
|
|
547
|
-
# Arrange
|
|
548
|
-
mocker.patch(
|
|
549
|
-
"matlab_proxy.settings.mwi_env.Experimental.is_mpa_enabled", return_value=True
|
|
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
546
|
def test_get_matlab_cmd_with_startup_profiling(mocker):
|
|
562
547
|
# Arrange
|
|
563
548
|
mocker.patch("matlab_proxy.settings.system.is_windows", return_value=False)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2023-
|
|
1
|
+
# Copyright 2023-2025 The MathWorks, Inc.
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
4
|
from aiohttp import web
|
|
@@ -90,7 +90,7 @@ async def fake_endpoint(request):
|
|
|
90
90
|
|
|
91
91
|
@pytest.fixture
|
|
92
92
|
def fake_server_with_auth_enabled(
|
|
93
|
-
|
|
93
|
+
event_loop, aiohttp_client, monkeypatch, get_custom_auth_token_str
|
|
94
94
|
):
|
|
95
95
|
auth_token = get_custom_auth_token_str
|
|
96
96
|
auth_enablement = "True"
|
|
@@ -120,7 +120,7 @@ def fake_server_with_auth_enabled(
|
|
|
120
120
|
aiohttp_session_setup(
|
|
121
121
|
app, EncryptedCookieStorage(f, cookie_name="matlab-proxy-session")
|
|
122
122
|
)
|
|
123
|
-
return
|
|
123
|
+
return event_loop.run_until_complete(aiohttp_client(app))
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
async def test_set_value_with_token(
|
|
@@ -256,7 +256,7 @@ async def test_get_value_with_token_in_query_params(
|
|
|
256
256
|
|
|
257
257
|
|
|
258
258
|
@pytest.fixture
|
|
259
|
-
def fake_server_without_auth_enabled(
|
|
259
|
+
def fake_server_without_auth_enabled(event_loop, aiohttp_client, monkeypatch):
|
|
260
260
|
auth_enablement = "False"
|
|
261
261
|
monkeypatch.setenv(
|
|
262
262
|
mwi_env.get_env_name_enable_mwi_auth_token(), str(auth_enablement)
|
|
@@ -281,7 +281,7 @@ def fake_server_without_auth_enabled(loop, aiohttp_client, monkeypatch):
|
|
|
281
281
|
aiohttp_session_setup(
|
|
282
282
|
app, EncryptedCookieStorage(f, cookie_name="matlab-proxy-session")
|
|
283
283
|
)
|
|
284
|
-
return
|
|
284
|
+
return event_loop.run_until_complete(aiohttp_client(app))
|
|
285
285
|
|
|
286
286
|
|
|
287
287
|
async def test_get_value(fake_server_without_auth_enabled):
|
tests/unit/util/test_mw.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2020-
|
|
1
|
+
# Copyright 2020-2025 The MathWorks, Inc.
|
|
2
2
|
|
|
3
3
|
import datetime
|
|
4
4
|
import random
|
|
@@ -519,7 +519,7 @@ def test_range_matlab_connector_ports():
|
|
|
519
519
|
not system.is_linux(),
|
|
520
520
|
reason="Xvfb is only required on linux based operating systems",
|
|
521
521
|
)
|
|
522
|
-
async def test_create_xvfb_process(
|
|
522
|
+
async def test_create_xvfb_process(event_loop):
|
|
523
523
|
"""Test to check if more than 1 xvfb process can be created with -displayfd flag
|
|
524
524
|
|
|
525
525
|
Creates 2 xvfb processes with '-displayfd' flag and checks if the processes are
|
tests/unit/util/test_util.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2020-
|
|
1
|
+
# Copyright 2020-2025 The MathWorks, Inc.
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import pytest
|
|
@@ -19,19 +19,19 @@ def test_get_supported_termination_signals():
|
|
|
19
19
|
assert len(system.get_supported_termination_signals()) >= 1
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
def test_add_signal_handlers(
|
|
23
|
-
"""Test to check if signal handlers are being added to asyncio
|
|
22
|
+
def test_add_signal_handlers(event_loop: asyncio.AbstractEventLoop):
|
|
23
|
+
"""Test to check if signal handlers are being added to asyncio event_loop
|
|
24
24
|
|
|
25
25
|
Args:
|
|
26
|
-
|
|
26
|
+
event_loop (asyncio event loop): built-in pytest fixture.
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
event_loop = add_signal_handlers(event_loop)
|
|
30
30
|
|
|
31
31
|
# In posix systems, event loop is modified with new signal handlers
|
|
32
32
|
if system.is_posix():
|
|
33
|
-
assert
|
|
34
|
-
assert
|
|
33
|
+
assert event_loop._signal_handlers is not None
|
|
34
|
+
assert event_loop._signal_handlers.items() is not None
|
|
35
35
|
|
|
36
36
|
else:
|
|
37
37
|
import signal
|