Skip to content

Commit af43652

Browse files
committed
added fix to Http_Shell__Server.python_exec method to take into account 3.13 change
updated to latest version of OSBot-Utils (and fixed refs to some classes and methods that had changed location)
1 parent 940ecee commit af43652

5 files changed

Lines changed: 12 additions & 18 deletions

File tree

osbot_fast_api/utils/http_shell/Http_Shell__Server.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ def ping():
9494
@staticmethod
9595
def python_exec(code):
9696
try:
97-
exec(code)
98-
return locals().get('result')
97+
local_vars = {}
98+
exec(code, {}, local_vars) # note: in previous version we used locals() here, but in 3.13 this behaviour changed
99+
return local_vars.get('result')
99100
except Exception as error:
100101
return {'error': f'{error}'}
101102

tests/integration/api/test__int__Middleware__Detect_Disconnect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
import requests
55
from unittest import IsolatedAsyncioTestCase
66
from fastapi import FastAPI
7+
from osbot_utils.helpers.duration.decorators.capture_duration import capture_duration
78
from requests import ReadTimeout
89
from starlette.requests import Request
910
from starlette.responses import JSONResponse, StreamingResponse
1011
from osbot_fast_api.api.middlewares.Middleware__Detect_Disconnect import Middleware__Detect_Disconnect
1112
from osbot_fast_api.utils.Fast_API_Server import Fast_API_Server
12-
from osbot_utils.context_managers.capture_duration import capture_duration
1313
from osbot_utils.testing.Stdout import Stdout
1414
from osbot_utils.utils.Threads import invoke_async
1515

tests/unit/api/middlewares/test_Middleware__Request_Duration.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
from unittest import TestCase
2-
3-
from osbot_utils.utils.Dev import pprint
1+
from unittest import TestCase
42
from tests.unit.fast_api__for_tests import fast_api_client
53

64

tests/unit/fast_api__for_tests.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
from osbot_utils.utils.Env import in_github_action
2-
3-
from osbot_fast_api.api.Fast_API import Fast_API
4-
from osbot_utils.context_managers.capture_duration import capture_duration
1+
from osbot_utils.helpers.duration.decorators.capture_duration import capture_duration
2+
from osbot_utils.utils.Env import in_github_action
3+
from osbot_fast_api.api.Fast_API import Fast_API
54

65
# use these static versions of the Fast_API object on tests, so that we don't created a new Fast_API object for each test
76
with capture_duration() as duration:

tests/unit/utils/test_Uvicorn_Server.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
from unittest import TestCase
2-
from unittest.mock import MagicMock, patch
3-
4-
from osbot_utils.testing.Duration import Duration
5-
from osbot_utils.utils.Dev import pprint
6-
from osbot_utils.utils.Files import path_combine, file_exists, parent_folder, folder_name
7-
from osbot_utils.utils.Http import is_port_open
8-
91
import osbot_fast_api
2+
from unittest import TestCase
3+
from unittest.mock import MagicMock, patch
4+
from osbot_utils.utils.Files import path_combine, file_exists, parent_folder, folder_name
5+
from osbot_utils.utils.Http import is_port_open
106
from osbot_fast_api.utils.Uvicorn_Server import Uvicorn_Server, UVICORN_SERVER_NAME
117

128

0 commit comments

Comments
 (0)