1) Ensure that eventlet's subprocess is used for Python versions up to 3.11 and await the issue resolution for Python versions 3.12.

2) Fixed unescape sequence for Python 3.12
This commit is contained in:
Akshay Joshi
2023-11-02 16:03:50 +05:30
parent 5d70803d6d
commit 9eb7c1cbea
9 changed files with 18 additions and 12 deletions

View File

@@ -100,7 +100,7 @@ class DomainReverseEngineeredSQLTestCase(BaseTestGenerator):
orig_sql = json.loads(get_response.data.decode('utf-8'))
# Replace multiple spaces with one space and check the expected sql
sql = re.sub('\s+', ' ', orig_sql).strip()
sql = re.sub(r'\s+', ' ', orig_sql).strip()
expected_sql = '-- DOMAIN: {0}.{1} -- DROP DOMAIN IF EXISTS ' \
'{0}.{1}; CREATE DOMAIN {0}.{1} {2} ' \
'ALTER DOMAIN {0}.{1} OWNER' \

View File

@@ -60,7 +60,7 @@ class ProcedureExecSQLTestCase(BaseTestGenerator):
exec_sql = json.loads(exec_response.data.decode('utf-8'))
# Replace multiple spaces with one space and check the expected sql
sql = re.sub('\s+', ' ', exec_sql).strip()
sql = re.sub(r'\s+', ' ', exec_sql).strip()
# Verify the expected EXEC SQL
if self.server_type == "pg":

View File

@@ -582,7 +582,7 @@ class EdbFuncView(PGChildNodeView, DataTypeReader):
if sql is None:
return None
start = 0
start_position = re.search("\s+[is|as]+\s+", sql, flags=re.I)
start_position = re.search(r"\s+[is|as]+\s+", sql, flags=re.I)
if start_position:
start = start_position.start() + 4

View File

@@ -11,7 +11,11 @@ import os
import select
import struct
import config
import subprocess
import sys
if sys.version_info >= (3, 12):
import subprocess
else:
from eventlet.green import subprocess
import re
from sys import platform as _platform
from config import PG_DEFAULT_DRIVER
@@ -391,8 +395,8 @@ def enter_key_press(data):
"""
user_input = data['input']
if user_input == '\q' or user_input == 'q\\q' or user_input in\
['\quit', 'exit', 'exit;']:
if user_input == r'\q' or user_input == 'q\\q' or user_input in\
[r'\quit', 'exit', 'exit;']:
# If user enter \q to terminate the PSQL, emit the msg to
# notify user connection is terminated.
sio.emit('pty-output',
@@ -553,7 +557,7 @@ def disconnect_socket():
process.terminate()
del app.config['sessions'][request.sid]
else:
os.write(app.config['sessions'][request.sid], '\q\n'.encode())
os.write(app.config['sessions'][request.sid], r'\q\n'.encode())
sio.sleep(1)
os.close(app.config['sessions'][request.sid])
os.close(cdata[request.sid])

View File

@@ -32,7 +32,7 @@ class TestSQLASCIIEncoding(BaseTestGenerator):
table_name='test_sql_ascii',
db_encoding='SQL_ASCII',
lc_collate='C',
test_str='\\\\Four\\\Three\\Two\One'
test_str=r'\\\\Four\\\Three\\Two\One'
)),
(
'Test SQL_ASCII data with file path',
@@ -40,7 +40,7 @@ class TestSQLASCIIEncoding(BaseTestGenerator):
table_name='test_sql_ascii',
db_encoding='SQL_ASCII',
lc_collate='C',
test_str='\\test\Documents\2017\12\19\AD93E646-'
test_str=r'\\test\Documents\2017\12\19\AD93E646-'
'E5FE-11E7-85AE-EB2E217F96F0.tif'
)),
(