matlab-proxy 0.26.0__py3-none-any.whl → 0.27.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 +13 -15
- matlab_proxy/app_state.py +8 -2
- matlab_proxy/default_configuration.py +2 -2
- matlab_proxy/gui/index.html +1 -1
- matlab_proxy/gui/static/js/{index.CZgGkMCD.js → index.BcDShXfH.js} +16 -16
- matlab_proxy/settings.py +3 -2
- matlab_proxy/util/list_servers.py +2 -2
- matlab_proxy/util/mwi/environment_variables.py +5 -0
- matlab_proxy/util/mwi/session_name.py +28 -0
- matlab_proxy/util/mwi/validators.py +2 -4
- {matlab_proxy-0.26.0.dist-info → matlab_proxy-0.27.0.dist-info}/METADATA +37 -25
- {matlab_proxy-0.26.0.dist-info → matlab_proxy-0.27.0.dist-info}/RECORD +19 -49
- {matlab_proxy-0.26.0.dist-info → matlab_proxy-0.27.0.dist-info}/WHEEL +1 -2
- matlab_proxy_manager/README.md +85 -0
- matlab_proxy_manager/lib/README.md +53 -0
- matlab_proxy_manager/storage/README.md +54 -0
- matlab_proxy_manager/web/README.md +37 -0
- matlab_proxy-0.26.0.dist-info/top_level.txt +0 -3
- tests/integration/__init__.py +0 -1
- tests/integration/integration_tests_with_license/__init__.py +0 -1
- tests/integration/integration_tests_with_license/conftest.py +0 -47
- tests/integration/integration_tests_with_license/test_http_end_points.py +0 -397
- tests/integration/integration_tests_without_license/__init__.py +0 -1
- tests/integration/integration_tests_without_license/conftest.py +0 -116
- tests/integration/integration_tests_without_license/test_matlab_is_down_if_unlicensed.py +0 -49
- tests/integration/utils/__init__.py +0 -1
- tests/integration/utils/integration_tests_utils.py +0 -352
- tests/integration/utils/licensing.py +0 -152
- tests/unit/__init__.py +0 -1
- tests/unit/conftest.py +0 -66
- tests/unit/test_app.py +0 -1299
- tests/unit/test_app_state.py +0 -1094
- tests/unit/test_constants.py +0 -7
- tests/unit/test_ddux.py +0 -22
- tests/unit/test_devel.py +0 -246
- tests/unit/test_non_dev_mode.py +0 -169
- tests/unit/test_settings.py +0 -679
- tests/unit/util/__init__.py +0 -3
- tests/unit/util/mwi/__init__.py +0 -1
- tests/unit/util/mwi/embedded_connector/__init__.py +0 -1
- tests/unit/util/mwi/embedded_connector/test_helpers.py +0 -29
- tests/unit/util/mwi/embedded_connector/test_request.py +0 -64
- tests/unit/util/mwi/test_custom_http_headers.py +0 -281
- tests/unit/util/mwi/test_download.py +0 -152
- tests/unit/util/mwi/test_logger.py +0 -82
- tests/unit/util/mwi/test_token_auth.py +0 -303
- tests/unit/util/mwi/test_validators.py +0 -364
- tests/unit/util/test_cookie_jar.py +0 -252
- tests/unit/util/test_mw.py +0 -550
- tests/unit/util/test_util.py +0 -221
- tests/utils/__init__.py +0 -1
- tests/utils/logging_util.py +0 -81
- {matlab_proxy-0.26.0.dist-info → matlab_proxy-0.27.0.dist-info}/entry_points.txt +0 -0
- {matlab_proxy-0.26.0.dist-info → matlab_proxy-0.27.0.dist-info/licenses}/LICENSE.md +0 -0
matlab_proxy/settings.py
CHANGED
|
@@ -21,7 +21,7 @@ from matlab_proxy.constants import MWI_AUTH_TOKEN_NAME_FOR_HTTP
|
|
|
21
21
|
from matlab_proxy.util import mwi, system
|
|
22
22
|
from matlab_proxy.util.cookie_jar import HttpOnlyCookieJar
|
|
23
23
|
from matlab_proxy.util.mwi import environment_variables as mwi_env
|
|
24
|
-
from matlab_proxy.util.mwi import token_auth
|
|
24
|
+
from matlab_proxy.util.mwi import token_auth, session_name
|
|
25
25
|
from matlab_proxy.util.mwi.exceptions import (
|
|
26
26
|
FatalError,
|
|
27
27
|
MatlabInstallError,
|
|
@@ -222,6 +222,7 @@ def get_dev_settings(config):
|
|
|
222
222
|
"is_windowmanager_available": False,
|
|
223
223
|
"mwi_idle_timeout": None,
|
|
224
224
|
"cookie_jar": _get_cookie_jar(),
|
|
225
|
+
"browser_title": session_name.get_browser_title("R2020b"),
|
|
225
226
|
}
|
|
226
227
|
|
|
227
228
|
|
|
@@ -324,7 +325,6 @@ def get_server_settings(config_name):
|
|
|
324
325
|
)
|
|
325
326
|
|
|
326
327
|
cookie_jar = _get_cookie_jar()
|
|
327
|
-
|
|
328
328
|
return {
|
|
329
329
|
"create_xvfb_cmd": create_xvfb_cmd,
|
|
330
330
|
"base_url": mwi.validators.validate_base_url(
|
|
@@ -406,6 +406,7 @@ def get_matlab_settings():
|
|
|
406
406
|
**mw_licensing_urls,
|
|
407
407
|
"nlm_conn_str": nlm_conn_str,
|
|
408
408
|
"has_custom_code_to_execute": has_custom_code_to_execute,
|
|
409
|
+
"browser_title": session_name.get_browser_title(matlab_version),
|
|
409
410
|
}
|
|
410
411
|
|
|
411
412
|
|
|
@@ -31,8 +31,8 @@ def print_server_info():
|
|
|
31
31
|
for server in search_results:
|
|
32
32
|
server_number += 1
|
|
33
33
|
with open(server) as f:
|
|
34
|
-
server_info = f.
|
|
35
|
-
print_output += str(server_number) + ". " + str(server_info)
|
|
34
|
+
server_info = f.readline().strip()
|
|
35
|
+
print_output += str(server_number) + ". " + str(server_info) + "\n"
|
|
36
36
|
|
|
37
37
|
print_output += str(
|
|
38
38
|
mwi_util.prettify(
|
|
@@ -172,6 +172,11 @@ def get_env_name_shutdown_on_idle_timeout():
|
|
|
172
172
|
return "MWI_SHUTDOWN_ON_IDLE_TIMEOUT"
|
|
173
173
|
|
|
174
174
|
|
|
175
|
+
def get_env_name_session_name():
|
|
176
|
+
"""User specified session name for the MATLAB Proxy instance, used to set the browser title."""
|
|
177
|
+
return "MWI_SESSION_NAME"
|
|
178
|
+
|
|
179
|
+
|
|
175
180
|
class Experimental:
|
|
176
181
|
"""This class houses functions which are undocumented APIs and Environment variables.
|
|
177
182
|
Note: Never add any state to this class. Its only intended for use as an abstraction layer
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Copyright 2025 The MathWorks, Inc.
|
|
2
|
+
"""This file provides functions to set a session name for the MATLAB Proxy instance."""
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
from matlab_proxy.util.mwi import environment_variables as mwi_env
|
|
6
|
+
from matlab_proxy.util.mwi import logger as mwi_logger
|
|
7
|
+
|
|
8
|
+
logger = mwi_logger.get()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _get_session_name():
|
|
12
|
+
"""Get the session name for the MATLAB Proxy instance.
|
|
13
|
+
|
|
14
|
+
Returns:
|
|
15
|
+
str: returns the user-defined session name if set, otherwise returns None.
|
|
16
|
+
"""
|
|
17
|
+
return os.getenv(mwi_env.get_env_name_session_name(), None)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def get_browser_title(matlab_version) -> str:
|
|
21
|
+
"""Get the browser title for the MATLAB Proxy instance."""
|
|
22
|
+
|
|
23
|
+
browser_title = "MATLAB " + (matlab_version or "")
|
|
24
|
+
session_name = _get_session_name()
|
|
25
|
+
if session_name:
|
|
26
|
+
browser_title = session_name + " - " + browser_title
|
|
27
|
+
logger.info("Session Name set to : %s", session_name)
|
|
28
|
+
return browser_title
|
|
@@ -214,11 +214,9 @@ def __get_configs():
|
|
|
214
214
|
Dict: Contains all the values present in 'matlab_web_desktop_configs' entry_point from all the packages
|
|
215
215
|
installed in the current environment.
|
|
216
216
|
"""
|
|
217
|
-
import importlib_metadata
|
|
217
|
+
import importlib_metadata as metadata
|
|
218
218
|
|
|
219
|
-
matlab_proxy_eps =
|
|
220
|
-
group=matlab_proxy.get_entrypoint_name()
|
|
221
|
-
)
|
|
219
|
+
matlab_proxy_eps = metadata.entry_points(group=matlab_proxy.get_entrypoint_name())
|
|
222
220
|
configs = {}
|
|
223
221
|
for entry_point in matlab_proxy_eps:
|
|
224
222
|
configs[entry_point.name.lower()] = entry_point.load()
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: matlab-proxy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.27.0
|
|
4
4
|
Summary: Python® package enables you to launch MATLAB® and access it from a web browser.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
Project-URL: Homepage, https://github.com/mathworks/matlab-proxy/
|
|
6
|
+
Project-URL: Documentation, https://github.com/mathworks/matlab-proxy/blob/main/README.md
|
|
7
|
+
Project-URL: Issues, https://github.com/mathworks/matlab-proxy/issues
|
|
8
|
+
Author-email: "The MathWorks Inc." <cloud@mathworks.com>
|
|
9
|
+
License-Expression: LicenseRef-MATHWORKS-CLOUD-REFERENCE-ARCHITECTURE-LICENSE
|
|
10
|
+
License-File: LICENSE.md
|
|
11
|
+
Keywords: MATLAB,MATLAB Javascript Desktop,MATLAB Proxy,MATLAB Web Desktop,Proxy,Remote MATLAB Web Access
|
|
10
12
|
Classifier: Intended Audience :: Developers
|
|
11
13
|
Classifier: Natural Language :: English
|
|
12
14
|
Classifier: Programming Language :: Python
|
|
@@ -14,30 +16,40 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
14
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
15
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
-
Requires-Python:
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
License-File: LICENSE.md
|
|
20
|
-
Requires-Dist: aiohttp>=3.7.4
|
|
19
|
+
Requires-Python: >=3.8
|
|
21
20
|
Requires-Dist: aiohttp-session[secure]
|
|
21
|
+
Requires-Dist: aiohttp>=3.7.4
|
|
22
22
|
Requires-Dist: importlib-metadata
|
|
23
23
|
Requires-Dist: importlib-resources
|
|
24
24
|
Requires-Dist: psutil
|
|
25
|
-
Requires-Dist: watchdog
|
|
26
25
|
Requires-Dist: requests
|
|
26
|
+
Requires-Dist: watchdog
|
|
27
27
|
Provides-Extra: dev
|
|
28
|
-
Requires-Dist: aiohttp-devtools; extra ==
|
|
29
|
-
Requires-Dist: black; extra ==
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist: pytest; extra ==
|
|
32
|
-
Requires-Dist: pytest-
|
|
33
|
-
Requires-Dist: pytest-
|
|
34
|
-
Requires-Dist: pytest-
|
|
35
|
-
Requires-Dist: pytest-
|
|
36
|
-
Requires-Dist: pytest-
|
|
37
|
-
Requires-Dist:
|
|
38
|
-
Requires-Dist:
|
|
39
|
-
Requires-Dist:
|
|
40
|
-
Requires-Dist:
|
|
28
|
+
Requires-Dist: aiohttp-devtools; extra == 'dev'
|
|
29
|
+
Requires-Dist: black; extra == 'dev'
|
|
30
|
+
Requires-Dist: psutil; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-aiohttp; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-asyncio==0.24.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest-env; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest-mock; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest-playwright; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest-timeout; extra == 'dev'
|
|
39
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
40
|
+
Requires-Dist: urllib3; extra == 'dev'
|
|
41
|
+
Provides-Extra: test
|
|
42
|
+
Requires-Dist: psutil; extra == 'test'
|
|
43
|
+
Requires-Dist: pytest; extra == 'test'
|
|
44
|
+
Requires-Dist: pytest-aiohttp; extra == 'test'
|
|
45
|
+
Requires-Dist: pytest-asyncio==0.24.0; extra == 'test'
|
|
46
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
47
|
+
Requires-Dist: pytest-env; extra == 'test'
|
|
48
|
+
Requires-Dist: pytest-mock; extra == 'test'
|
|
49
|
+
Requires-Dist: pytest-playwright; extra == 'test'
|
|
50
|
+
Requires-Dist: pytest-timeout; extra == 'test'
|
|
51
|
+
Requires-Dist: urllib3; extra == 'test'
|
|
52
|
+
Description-Content-Type: text/markdown
|
|
41
53
|
|
|
42
54
|
# MATLAB Proxy
|
|
43
55
|
[](https://github.com/mathworks/matlab-proxy/actions) [](https://pypi.python.org/pypi/matlab-proxy) [](https://codecov.io/gh/mathworks/matlab-proxy) [](https://pepy.tech/project/matlab-proxy)
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
matlab_proxy/__init__.py,sha256=6cwi8buKCMtw9OeWaOYUHEoqwl5MyJ_s6GxgNuqPuNg,1673
|
|
2
|
-
matlab_proxy/app.py,sha256=
|
|
3
|
-
matlab_proxy/app_state.py,sha256=
|
|
2
|
+
matlab_proxy/app.py,sha256=QPBSPDneHvqH7T6NHN-bGxluEjHS-fkYGDC0TVDZKvE,37490
|
|
3
|
+
matlab_proxy/app_state.py,sha256=oijVEr2iBSu1bf-Pc7Mr8-mVFsPDqE81xkDrOcwN504,73559
|
|
4
4
|
matlab_proxy/constants.py,sha256=gYpS3mls1i3cO4eExbqQO-z_h8QIWTkM9h2S_EAMWSU,1257
|
|
5
|
-
matlab_proxy/default_configuration.py,sha256=
|
|
5
|
+
matlab_proxy/default_configuration.py,sha256=7xjsCzma4c6u0rEzio8xhHaDRy0wY2xtGXuARY2v0hc,1881
|
|
6
6
|
matlab_proxy/devel.py,sha256=nR6XPVBUEdQ-RZGtYvX1YHTp8gj9cuw5Hp8ahasMBc8,14310
|
|
7
|
-
matlab_proxy/settings.py,sha256=
|
|
7
|
+
matlab_proxy/settings.py,sha256=yKnjprDNml-wO4Ae-6MiGa9EG1NIzvh-HaCGu-loQBg,29480
|
|
8
8
|
matlab_proxy/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
matlab_proxy/gui/favicon.ico,sha256=7w7Ki1uQP2Rgwc64dOV4-NrTu97I3WsZw8OvRSoY1A0,130876
|
|
10
|
-
matlab_proxy/gui/index.html,sha256=
|
|
10
|
+
matlab_proxy/gui/index.html,sha256=DsOZs5RaM72cflhcqV8UUZ8NwS09JlcZG-zlN5XfUcE,720
|
|
11
11
|
matlab_proxy/gui/manifest.json,sha256=NwDbrALM5auYyj2bbEf4aGwAUDqNl1FzMFQpPiG2Ty4,286
|
|
12
12
|
matlab_proxy/gui/robots.txt,sha256=kNJLw79pisHhc3OVAimMzKcq3x9WT6sF9IS4xI0crdI,67
|
|
13
13
|
matlab_proxy/gui/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
matlab_proxy/gui/static/css/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
matlab_proxy/gui/static/css/index.BSVLACuY.css,sha256=LzuRvV10Z0pF0ugGSnj5zKJvT4AHwwBbCd-wSH4mHjg,305333
|
|
16
16
|
matlab_proxy/gui/static/js/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
-
matlab_proxy/gui/static/js/index.
|
|
17
|
+
matlab_proxy/gui/static/js/index.BcDShXfH.js,sha256=9_MsXzl9doo6Lniy_MxwMZe3VlJGepCDsdJ_3mxsKQk,280073
|
|
18
18
|
matlab_proxy/gui/static/media/MATLAB-env-blur.NupTbPv_.png,sha256=QpmQTLDvBu2-b7ev83Rvpt0Q72R6wdQGkuJMPPpjv7M,220290
|
|
19
19
|
matlab_proxy/gui/static/media/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
matlab_proxy/gui/static/media/glyphicons-halflings-regular.BKjkU69z.woff,sha256=omOU9-3hAMoRjv8u2ghZYnWpg5uVnCJuFUOVV6WoB0I,23424
|
|
@@ -42,24 +42,28 @@ matlab_proxy/matlab/startup.m,sha256=UcA4i2lAMytwBsO783uPIQoP5Pzw1R0xrUywbBBtTjw
|
|
|
42
42
|
matlab_proxy/util/__init__.py,sha256=JkVIsTOae5giDK0cQ7jcxQSHa8zo1umdq-1C0grDZwk,11712
|
|
43
43
|
matlab_proxy/util/cookie_jar.py,sha256=GceKyB53lTX5r2wp9myvf0JDWDfvSamvjb4zmjkoOtY,2401
|
|
44
44
|
matlab_proxy/util/event_loop.py,sha256=sX_0tKlirCY5ImLxkss_XO4Ksj65u6JHtwMj25oGL94,1816
|
|
45
|
-
matlab_proxy/util/list_servers.py,sha256=
|
|
45
|
+
matlab_proxy/util/list_servers.py,sha256=vdagTACoNM9zxJHeagAF7EbQNV-BjFsinf4JSX8H3SE,1388
|
|
46
46
|
matlab_proxy/util/mw.py,sha256=dLGSdfcTZiwKR1MMZA-39o-8na13IEPZOGBqcaHmKVI,11086
|
|
47
47
|
matlab_proxy/util/system.py,sha256=XoT3Rv5MwPkdfhk2oMvUwxxlzZmADMlxzi9IRQyGgbA,1692
|
|
48
48
|
matlab_proxy/util/windows.py,sha256=_5gl2IyHIfw8-D3_G5uHkycZVGGFVXtjkd6_aP3g2Ts,3785
|
|
49
49
|
matlab_proxy/util/mwi/__init__.py,sha256=zI-X1lafr8H3j17PyA0oSZ0q5nINfK-WDA7VmJKmSAQ,158
|
|
50
50
|
matlab_proxy/util/mwi/custom_http_headers.py,sha256=kfDjSnEXEVzoF2pZuEn76LKayeD2WKoQEDu2Y9EMOAo,7154
|
|
51
51
|
matlab_proxy/util/mwi/download.py,sha256=-GJj3yOsL4vF_9baqRXkgBI-vu_OwjZMQVkJXFS8GMc,4965
|
|
52
|
-
matlab_proxy/util/mwi/environment_variables.py,sha256=
|
|
52
|
+
matlab_proxy/util/mwi/environment_variables.py,sha256=1toY2D1vybmNin0jq-vhx86B2bXAUpb5Njw0soyaiTQ,7134
|
|
53
53
|
matlab_proxy/util/mwi/exceptions.py,sha256=8o4PZmira_ZonnOROzu8ERIiSn9y-456JO89gqjCags,5446
|
|
54
54
|
matlab_proxy/util/mwi/logger.py,sha256=GoisSphy3Jyi5-6-X0WRl1YkdrKx2xzjSxBN_w3oTU8,3802
|
|
55
|
+
matlab_proxy/util/mwi/session_name.py,sha256=HQAGMlJo6KMb2f9MBcavni48nw9H-cHWMeJKmXxpeys,915
|
|
55
56
|
matlab_proxy/util/mwi/token_auth.py,sha256=UbIWqo7qADaZdijFvorLYsZbxzaB8TycGP8nk305ru0,9997
|
|
56
|
-
matlab_proxy/util/mwi/validators.py,sha256=
|
|
57
|
+
matlab_proxy/util/mwi/validators.py,sha256=tofVI81DT0KinxZ99XeN96ybkwz-6Lt-e-tN7PXkolk,13235
|
|
57
58
|
matlab_proxy/util/mwi/embedded_connector/__init__.py,sha256=Vfl2hNC7V1IwoK9_wrwfENs4BC8P-Mvvqh4BNGi2n48,119
|
|
58
59
|
matlab_proxy/util/mwi/embedded_connector/helpers.py,sha256=kpIgJN0AqYLeX56UylWgB0t07fg8sh0RhIlUH_8JitM,3654
|
|
59
60
|
matlab_proxy/util/mwi/embedded_connector/request.py,sha256=RXoVvrm5fibVb2A6EZnkMWwAQkYX3J5kqDTGQDZo9p0,4316
|
|
61
|
+
matlab_proxy_manager/README.md,sha256=7F9KyrilUWhPH5qZtKHB_6iZK5cVRuccJr0LroP1hXo,3431
|
|
60
62
|
matlab_proxy_manager/__init__.py,sha256=CMqm2aSYUWo5sxV3vyqWudrQU31muouSqZRDesJNJSA,178
|
|
63
|
+
matlab_proxy_manager/lib/README.md,sha256=233q4O0NzLzeOTWsCrHIboU-i-NAMb-SBq5SBMDwyhk,2193
|
|
61
64
|
matlab_proxy_manager/lib/__init__.py,sha256=KfwQxxM5a1kMRtNbhz8tb7YfHp8e2d0tNLB55wYvDS8,37
|
|
62
65
|
matlab_proxy_manager/lib/api.py,sha256=rDnxA599DZI73TUBSn8JPCbmKM_kn_T_J0dw0z4Kg5M,14380
|
|
66
|
+
matlab_proxy_manager/storage/README.md,sha256=OmToUE1lD7evUtmg0yCc9oHlqg5mN4rzmePfHwuXYC0,2106
|
|
63
67
|
matlab_proxy_manager/storage/__init__.py,sha256=KfwQxxM5a1kMRtNbhz8tb7YfHp8e2d0tNLB55wYvDS8,37
|
|
64
68
|
matlab_proxy_manager/storage/file_repository.py,sha256=U4FAw0zFN9z7YNlaMsYZXWm5ccs3rp3bzZL-W2BNhxA,5187
|
|
65
69
|
matlab_proxy_manager/storage/interface.py,sha256=pnRRD0Ku3gzbruAOM3J3NI2Kk8do3-_yRw9Pag1IqnE,1883
|
|
@@ -71,47 +75,13 @@ matlab_proxy_manager/utils/environment_variables.py,sha256=A1E4RfSR21vWlWuoFy0Jr
|
|
|
71
75
|
matlab_proxy_manager/utils/exceptions.py,sha256=t_LykVJx7A4M-G6vg43PgzK7u7zE8i1c6aMhLSpqQOQ,1217
|
|
72
76
|
matlab_proxy_manager/utils/helpers.py,sha256=_BH4qvJwfJYdfdv0I6dbugQjNJ_wxnUsfD5OrsPvCCM,9989
|
|
73
77
|
matlab_proxy_manager/utils/logger.py,sha256=HCQNjF0rHbDBvKhMBxGWs-FVH_GLTUDKIyXDqzLMAzc,1986
|
|
78
|
+
matlab_proxy_manager/web/README.md,sha256=_RADHyuBhVZiZmHV7vKXkKkxyh9c-z-rzxr67pssxQI,2578
|
|
74
79
|
matlab_proxy_manager/web/__init__.py,sha256=KfwQxxM5a1kMRtNbhz8tb7YfHp8e2d0tNLB55wYvDS8,37
|
|
75
80
|
matlab_proxy_manager/web/app.py,sha256=-sfeJ4ltvcT1-8m0rOZkn357XQTSSNSPIUb3fidT71Y,20643
|
|
76
81
|
matlab_proxy_manager/web/monitor.py,sha256=PWkwV0kP3XHCxDRHpurPh74Zg-SgaIXnCnX2xZSW_R8,1541
|
|
77
82
|
matlab_proxy_manager/web/watcher.py,sha256=89JHjBAQtOrllstaJFxqrjHwckpRmu3qfUqeqPLmH2Q,2130
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
tests/integration/integration_tests_without_license/conftest.py,sha256=n-oppKWxavyy1O0J6DywO3DnOHuYc7yUZRXm3Bt4szU,3526
|
|
84
|
-
tests/integration/integration_tests_without_license/test_matlab_is_down_if_unlicensed.py,sha256=tkdyhfZBpfJpbnEzjURyV-GE0p43YxOa9xooJf-JoM4,1653
|
|
85
|
-
tests/integration/utils/__init__.py,sha256=ttzJ8xKWGxOJZz56qOiWOn6sp5LGomkZMn_w4KJLRMU,42
|
|
86
|
-
tests/integration/utils/integration_tests_utils.py,sha256=IbJ9CedFHiz3k85FBY-8GwotTnjPF3jF4AHdKio7jqk,10321
|
|
87
|
-
tests/integration/utils/licensing.py,sha256=rEBjvMXO8R3mL6KnePu2lojmOsjD4GXl9frf9N0Wacs,4842
|
|
88
|
-
tests/unit/__init__.py,sha256=KfwQxxM5a1kMRtNbhz8tb7YfHp8e2d0tNLB55wYvDS8,37
|
|
89
|
-
tests/unit/conftest.py,sha256=FIL7bhw2-9B5OEspqt9toZ2ZlN18pOsPEFjeQmVNcSk,1916
|
|
90
|
-
tests/unit/test_app.py,sha256=PhnkFIgJok5TQbwa5OEJc2-hH1YJVRGkahiZw3V60jw,43516
|
|
91
|
-
tests/unit/test_app_state.py,sha256=ZhywxbZb9HCxLQjgW1QEHccaydCeGKX20YOFFjpKWYM,38047
|
|
92
|
-
tests/unit/test_constants.py,sha256=2nXxTmDP8utr8krsfZ4c_Bh4_mWPcDO5uI8MXeq4Usg,158
|
|
93
|
-
tests/unit/test_ddux.py,sha256=a2J2iM8j_nnfJVuMI38p5AjwrRdoMj3N88gFgS2I4hg,713
|
|
94
|
-
tests/unit/test_devel.py,sha256=A-1iVhSSwmywaW65QIRcUS2Fk7nJxceCcCm7CJtNdEc,7982
|
|
95
|
-
tests/unit/test_non_dev_mode.py,sha256=Jqs5W-ax6WNM9v5SeTjpmVsojjA95itPC8Lqhs2U3Oc,5533
|
|
96
|
-
tests/unit/test_settings.py,sha256=0vwuEw2QSNLdOaCbV8kaVlRYEGabfWBOKpzHGgpv4e0,23924
|
|
97
|
-
tests/unit/util/__init__.py,sha256=GInSQBb2SoVD5LZfmSCQa9-UZJT_UP-jNfrojkgCybU,87
|
|
98
|
-
tests/unit/util/test_cookie_jar.py,sha256=t9UaRos-TMC-jjuFvYwwJrm5dd1UxmZAWpCPqs_wGiY,7209
|
|
99
|
-
tests/unit/util/test_mw.py,sha256=hweBw3ijcdh_2QdECjAWNkmh_7P5Df728cgD51DFkT8,18571
|
|
100
|
-
tests/unit/util/test_util.py,sha256=n-xSkwdqXfq550jWYsmjhGjx6L98URhWeLJLKhGekOw,7476
|
|
101
|
-
tests/unit/util/mwi/__init__.py,sha256=pl5jqyCHEwZEviiL8OC-SHulb1rBecstQCFF6qVjL9Y,37
|
|
102
|
-
tests/unit/util/mwi/test_custom_http_headers.py,sha256=UfrhclS0j6WhShtg1ki2oF1kK8JqRC29uevH4tuDqF4,11182
|
|
103
|
-
tests/unit/util/mwi/test_download.py,sha256=jYwPJFYGrPKqnkIJW42XYSe1fowmzChAkOx0k0xVldo,4779
|
|
104
|
-
tests/unit/util/mwi/test_logger.py,sha256=S0Q5TirFxysrH2YSxRzGY9mWoWB83hG3q3XpGENCpcw,3150
|
|
105
|
-
tests/unit/util/mwi/test_token_auth.py,sha256=0gp41Y7zZFqeFDCA0V3Arv_CqnQKo5RZqijIccvezYM,10562
|
|
106
|
-
tests/unit/util/mwi/test_validators.py,sha256=GvLP3lSvoOQAjoclYunKPfxPIagUsnVGHRskHELResE,11765
|
|
107
|
-
tests/unit/util/mwi/embedded_connector/__init__.py,sha256=pl5jqyCHEwZEviiL8OC-SHulb1rBecstQCFF6qVjL9Y,37
|
|
108
|
-
tests/unit/util/mwi/embedded_connector/test_helpers.py,sha256=vYTWNUTuDeaygo16JGMTvWeI_CLOnvPkwNJmLndvJhE,890
|
|
109
|
-
tests/unit/util/mwi/embedded_connector/test_request.py,sha256=PR-jddnXDEiip-lD7A_QSvRwEkwo3eQ8owZlk-r9vnk,1867
|
|
110
|
-
tests/utils/__init__.py,sha256=ttzJ8xKWGxOJZz56qOiWOn6sp5LGomkZMn_w4KJLRMU,42
|
|
111
|
-
tests/utils/logging_util.py,sha256=VBy_NRvwau3C_CVTBjK5RMROrQimnJYHO2U0aKSZiRw,2234
|
|
112
|
-
matlab_proxy-0.26.0.dist-info/LICENSE.md,sha256=oF0h3UdSF-rlUiMGYwi086ZHqelzz7yOOk9HFDv9ELo,2344
|
|
113
|
-
matlab_proxy-0.26.0.dist-info/METADATA,sha256=Ywtdmy9yOZSwbwTEe90oqr-PQvPlSgpZ3ZtgKxc4u6s,10666
|
|
114
|
-
matlab_proxy-0.26.0.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
115
|
-
matlab_proxy-0.26.0.dist-info/entry_points.txt,sha256=3wztwXpt6wdGfTwscc4qHbCeWzi0E2XhyJbMDndyQKc,304
|
|
116
|
-
matlab_proxy-0.26.0.dist-info/top_level.txt,sha256=KF-347aoRGsfHTpiSqfIPUZ95bzK5-oMIu8S_TUcu-w,40
|
|
117
|
-
matlab_proxy-0.26.0.dist-info/RECORD,,
|
|
83
|
+
matlab_proxy-0.27.0.dist-info/METADATA,sha256=80E3g1CABuNM_zS6w8lhzJ8IbkfzvM1Nny7pui82kO4,11323
|
|
84
|
+
matlab_proxy-0.27.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
85
|
+
matlab_proxy-0.27.0.dist-info/entry_points.txt,sha256=3wztwXpt6wdGfTwscc4qHbCeWzi0E2XhyJbMDndyQKc,304
|
|
86
|
+
matlab_proxy-0.27.0.dist-info/licenses/LICENSE.md,sha256=oF0h3UdSF-rlUiMGYwi086ZHqelzz7yOOk9HFDv9ELo,2344
|
|
87
|
+
matlab_proxy-0.27.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# MATLAB Proxy Manager
|
|
2
|
+
|
|
3
|
+
----
|
|
4
|
+
This README is intended for MathWorks® developers only.
|
|
5
|
+
`matlab-proxy-manager` is part of the `matlab-proxy` package and it helps in managing the lifecycle and proxying of MATLAB proxy processes.
|
|
6
|
+
|
|
7
|
+
It provides a seamless integration with Jupyter environments, allowing MATLAB to be accessed and controlled via a proxy.
|
|
8
|
+
|
|
9
|
+
Upon installation, this package introduces an executable `matlab-proxy-manager-app`, which is utilized by the Jupyter Server Proxy to initiate `matlab-proxy-manager`.
|
|
10
|
+
|
|
11
|
+
----
|
|
12
|
+
|
|
13
|
+
**Table of Contents**
|
|
14
|
+
- [Project Structure](#structure)
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [PyPI](#pypi)
|
|
17
|
+
- [Building From Sources](#building-from-sources)
|
|
18
|
+
- [Usage](#usage)
|
|
19
|
+
- [Security](#security)
|
|
20
|
+
|
|
21
|
+
## Structure
|
|
22
|
+
`matlab-proxy-manager` is organized into several key sub-folders:
|
|
23
|
+
|
|
24
|
+
1. lib:
|
|
25
|
+
|
|
26
|
+
* This directory contains the library APIs that facilitate the invocation of MATLAB proxy processes. It supports API calls, enabling the MATLAB Kernel to manage proxy instances effectively. For detailed information, refer to the README within the lib folder.
|
|
27
|
+
|
|
28
|
+
2. storage:
|
|
29
|
+
* The file system serves as the source of truth for `matlab-proxy-manager`, storing metadata about each MATLAB proxy server in dedicated files. A new file is generated whenever a proxy instance is launched and is removed upon termination of the instance or deletion of the Kernel that initiated it.
|
|
30
|
+
|
|
31
|
+
3. web:
|
|
32
|
+
* This component handles proxy workflows through HTTP/WebSocket requests, which are part of the executable process spawned by clients using the `matlab-proxy-manager-app`. For specific requirements and constraints, consult the README located in the web folder.
|
|
33
|
+
|
|
34
|
+
4. utils:
|
|
35
|
+
* A collection of helper functions utilized across various parts of the project, ensuring modularity and code reuse.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
### PyPI
|
|
40
|
+
`matlab-proxy-manager` is included in the `matlab-proxy` repository and can be easily installed from the Python Package Index:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
python -m pip install matlab-proxy
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Building From Sources
|
|
47
|
+
Building from sources requires Node.js® version 16 or higher. [Click here to install Node.js](https://nodejs.org/en/)
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/mathworks/matlab-proxy.git
|
|
51
|
+
|
|
52
|
+
cd matlab-proxy
|
|
53
|
+
|
|
54
|
+
python -m pip install .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Installing the package creates an executable called `matlab-proxy-app`, which is placed onto your system PATH by `pip`, usually in: `$HOME/.local/bin/`
|
|
58
|
+
```bash
|
|
59
|
+
# Verify its presence on the PATH
|
|
60
|
+
which matlab-proxy-manager-app
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
`matlab-proxy-manager` can be deployed in two modes:
|
|
65
|
+
|
|
66
|
+
1. Library Mode: Import the relevant module within your client code to invoke public APIs directly.
|
|
67
|
+
|
|
68
|
+
Example:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import matlab_proxy_manager.lib.api as mpm_lib
|
|
72
|
+
response = await mpm_lib.start_matlab_proxy_for_kernel(...)
|
|
73
|
+
await mpm_lib.shutdown(...)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
2. Process Mode: This mode is primarily managed by Jupyter-Server-Proxy for proxy workflows involving web-based MATLAB desktop access.
|
|
77
|
+
|
|
78
|
+
## Security
|
|
79
|
+
Security is paramount in matlab-proxy-manager. Communication between the Kernel, proxy manager, and Jupyter Server Proxy is secured using authentication tokens. These tokens are mandatory for API invocations and proxy workflows. They are passed via environment variables when the proxy manager is initiated by the Jupyter Server Proxy and are included in the arguments during Kernel API calls.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
Copyright 2024 The MathWorks, Inc.
|
|
84
|
+
|
|
85
|
+
---
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# MATLAB Proxy Manager - Library
|
|
2
|
+
|
|
3
|
+
This README is intended for MathWorks® developers only.
|
|
4
|
+
`matlab-proxy-manager` module is designed to be flexible and robust, supporting both direct library calls and process-based workflows. The lib folder contains the code blocks providing the core library APIs that facilitate the management of MATLAB proxy instances.
|
|
5
|
+
|
|
6
|
+
# Key Features
|
|
7
|
+
## API Invocation:
|
|
8
|
+
|
|
9
|
+
The lib module allows for the invocation of MATLAB proxy processes through a well-defined set of APIs. These APIs are designed to be intuitive and easy to integrate into existing workflows, enabling developers to start, stop, and manage MATLAB proxy instances programmatically.
|
|
10
|
+
|
|
11
|
+
## Integration with MATLAB Kernel:
|
|
12
|
+
|
|
13
|
+
The APIs in the lib directory are used by the MATLAB Kernel to manage the lifecycle of MATLAB proxy instances. This includes starting new instances and shutting them down when they are no longer needed.
|
|
14
|
+
|
|
15
|
+
## Error Handling and Logging:
|
|
16
|
+
|
|
17
|
+
Comprehensive error handling mechanisms are in place to ensure that any issues encountered during the management of proxy instances are logged and reported. This aids in troubleshooting and ensures the reliability of the system.
|
|
18
|
+
|
|
19
|
+
Users are required to set `MWI_MPM_LOG_LEVEL` environment variable to their desired log level (`INFO`, `DEBUG` etc.) to enable logging in `matlab-proxy-manager`.
|
|
20
|
+
|
|
21
|
+
# Usage
|
|
22
|
+
To use the lib APIs, you can import the relevant module in your Python code and invoke the provided functions. Here’s a basic example of how you might start and stop a MATLAB proxy instance:
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
|
|
26
|
+
import matlab_proxy_manager.lib.api as mpm_lib
|
|
27
|
+
|
|
28
|
+
# Start a MATLAB proxy instance
|
|
29
|
+
response = await mpm_lib.start_matlab_proxy_for_kernel(
|
|
30
|
+
caller_id=self.kernel_id,
|
|
31
|
+
parent_id=self.parent_pid,
|
|
32
|
+
is_shared_matlab=True,
|
|
33
|
+
)
|
|
34
|
+
return (
|
|
35
|
+
response.get("absolute_url"),
|
|
36
|
+
response.get("mwi_base_url"),
|
|
37
|
+
response.get("headers"),
|
|
38
|
+
response.get("mpm_auth_token"),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# Perform operations with the MATLAB instance...
|
|
42
|
+
|
|
43
|
+
# Shut down the MATLAB proxy instance
|
|
44
|
+
await mpm_lib.shutdown(
|
|
45
|
+
self.parent_pid, self.kernel_id, self.mpm_auth_token
|
|
46
|
+
)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
Copyright 2024 The MathWorks, Inc.
|
|
52
|
+
|
|
53
|
+
---
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# MATLAB Proxy Manager - Storage
|
|
2
|
+
|
|
3
|
+
This README is intended for MathWorks® developers only.
|
|
4
|
+
The storage module is a critical part of the `matlab-proxy-manager`, responsible for managing the persistence of metadata related to MATLAB proxy instances. It employs a repository pattern to provide a clean and consistent interface for performing CRD (Create, Read, Delete) operations on the file system.
|
|
5
|
+
|
|
6
|
+
## Key Features
|
|
7
|
+
|
|
8
|
+
### Repository Pattern:
|
|
9
|
+
|
|
10
|
+
The storage module is designed using the repository pattern, which abstracts the data layer and provides a straightforward API for interacting with stored metadata. This pattern ensures that the underlying data storage mechanism can be modified or replaced with minimal impact on the rest of the application.
|
|
11
|
+
|
|
12
|
+
### File System-Based Storage:
|
|
13
|
+
|
|
14
|
+
Currently, the storage operations are performed directly on the file system. Each MATLAB proxy instance's metadata is stored in a separate file, making it easy to manage and access individual instances.
|
|
15
|
+
|
|
16
|
+
### CRD Operations:
|
|
17
|
+
|
|
18
|
+
The storage module provides a set of APIs to perform CRD operations:
|
|
19
|
+
|
|
20
|
+
1. add(...): Create a new metadata file for a MATLAB proxy instance.
|
|
21
|
+
2. get(...): Retrieve metadata for a specific instance.
|
|
22
|
+
3. get_all(): Retrieve metadata for all instances.
|
|
23
|
+
4. delete(...): Remove the metadata file for a specific instance.
|
|
24
|
+
|
|
25
|
+
Usage
|
|
26
|
+
To use the storage APIs, clients can import the relevant module and invoke the provided functions. Here’s an example of how to perform basic CRUD operations:
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
|
|
30
|
+
from matlab_proxy_manager.storage.file_repository import FileRepository
|
|
31
|
+
|
|
32
|
+
storage = FileRepository(data_dir)
|
|
33
|
+
|
|
34
|
+
# Add a new MATLAB proxy instance metadata
|
|
35
|
+
filename = '1234.info'
|
|
36
|
+
server_process = <instance of ServerProcess class>
|
|
37
|
+
storage.add(server=server_process, filename=filename)
|
|
38
|
+
|
|
39
|
+
# Retrieve metadata for a specific instance
|
|
40
|
+
filename = f"{parent_pid}_{caller_id}"
|
|
41
|
+
full_file_path, server = storage.get(filename)
|
|
42
|
+
|
|
43
|
+
# Retrieve metadata for all instances
|
|
44
|
+
servers = storage.get_all()
|
|
45
|
+
|
|
46
|
+
# Delete metadata for a specific instance
|
|
47
|
+
storage.delete(f"{filename}.info")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
Copyright 2024 The MathWorks, Inc.
|
|
53
|
+
|
|
54
|
+
---
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# MATLAB Proxy Manager - Web
|
|
2
|
+
|
|
3
|
+
This README is intended for MathWorks® developers only.
|
|
4
|
+
The web module is an important component of the matlab-proxy-manager, responsible for initiating the proxy manager in process mode. This module is specifically designed to be utilized within the Jupyter ecosystem, facilitating seamless integration with Jupyter Server Proxy.
|
|
5
|
+
|
|
6
|
+
## Key Features
|
|
7
|
+
### Process Mode Execution:
|
|
8
|
+
|
|
9
|
+
The web module contains the code necessary to start the MATLAB proxy manager in process mode. This mode is essential for managing MATLAB sessions within a Jupyter environment, allowing users to interact with MATLAB through a web-based interface.
|
|
10
|
+
|
|
11
|
+
### Integration with Jupyter Server Proxy:
|
|
12
|
+
|
|
13
|
+
The web module is accessed exclusively by the Jupyter Server Proxy. It ensures that MATLAB can be launched and managed effectively as part of a Jupyter session, providing a seamless user experience.
|
|
14
|
+
|
|
15
|
+
### Environment Variable Configuration:
|
|
16
|
+
|
|
17
|
+
The web module relies on three critical environment variables to function correctly:
|
|
18
|
+
1. MWI_MPM_PORT: Specifies the port on which the proxy manager should start. This allows for flexible configuration and ensures that the proxy manager can be accessed on the appropriate network endpoint.
|
|
19
|
+
2. MWI_MPM_AUTH_TOKEN: Used for secure communication between the Jupyter Server Proxy and the proxy manager. This token ensures that only authorized requests can interact with the proxy manager, enhancing security.
|
|
20
|
+
3. MWI_MPM_PARENT_PID: Provides context for the process, allowing resources to be filtered based on their originating parent process. This is particularly useful for distinguishing resources started by different Jupyter servers.
|
|
21
|
+
|
|
22
|
+
### Support for Proxy Workflow:
|
|
23
|
+
|
|
24
|
+
The web module supports the proxy workflow, which is activated when the MATLAB Web Desktop is launched. This workflow ensures that users can access MATLAB's graphical interface through their web browser, maintaining a consistent and interactive experience.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
The web module is typically invoked by the Jupyter Server Proxy and does not require direct interaction from end-users. However, it is essential to ensure that the necessary environment variables are correctly set before launching the module.
|
|
28
|
+
|
|
29
|
+
## Design Considerations
|
|
30
|
+
1. Security: The use of an authentication token ensures secure communication between components, preventing unauthorized access.
|
|
31
|
+
2. Flexibility: By leveraging environment variables, the web module can be easily configured to meet the specific needs of different deployment environments.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
Copyright 2024 The MathWorks, Inc.
|
|
36
|
+
|
|
37
|
+
---
|
tests/integration/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Copyright 2023-2024 The MathWorks, Inc.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 The MathWorks, Inc.
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Copyright 2023-2024 The MathWorks, Inc.
|
|
2
|
-
|
|
3
|
-
import os
|
|
4
|
-
from tests.integration.utils import integration_tests_utils as utils
|
|
5
|
-
import pytest
|
|
6
|
-
from matlab_proxy.util.mwi import environment_variables as mwi_env
|
|
7
|
-
from tests.utils.logging_util import create_integ_test_logger
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
_logger = create_integ_test_logger(
|
|
11
|
-
__name__, log_file_path=os.getenv("MWI_INTEG_TESTS_LOG_FILE_PATH")
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@pytest.fixture(scope="module", name="module_monkeypatch")
|
|
16
|
-
def monkeypatch_module_scope_fixture():
|
|
17
|
-
"""
|
|
18
|
-
To ensure that modifications made with the monkeypatch fixture
|
|
19
|
-
persist across all tests in the module, this fixture
|
|
20
|
-
has been created in 'module' scope. This is done because a 'module'
|
|
21
|
-
scope object is needed with matlab-proxy 'module' scope fixture.
|
|
22
|
-
This allows us to patch certain aspects, like environment variables,
|
|
23
|
-
for all tests within the module.
|
|
24
|
-
|
|
25
|
-
Yields:
|
|
26
|
-
class object: Object of class MonkeyPatch
|
|
27
|
-
"""
|
|
28
|
-
with pytest.MonkeyPatch.context() as mp:
|
|
29
|
-
yield mp
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@pytest.fixture(autouse=True, scope="module")
|
|
33
|
-
def matlab_proxy_fixture(module_monkeypatch, request):
|
|
34
|
-
"""
|
|
35
|
-
Pytest fixture for managing a standalone matlab-proxy process
|
|
36
|
-
for testing purposes. This fixture sets up a matlab-proxy process in
|
|
37
|
-
the module scope, and tears it down after all the tests are executed.
|
|
38
|
-
"""
|
|
39
|
-
|
|
40
|
-
utils.perform_basic_checks()
|
|
41
|
-
|
|
42
|
-
module_monkeypatch.setenv(mwi_env.get_env_name_testing(), "false")
|
|
43
|
-
module_monkeypatch.setenv(mwi_env.get_env_name_development(), "false")
|
|
44
|
-
_logger.info("Started MATLAB Proxy process")
|
|
45
|
-
|
|
46
|
-
# Run the matlab proxy tests
|
|
47
|
-
yield
|