Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1618d7c

Browse files
A support of Python 3.8 [typing]
Python 3.8 does not support tuple[...], list[...], set[...] and so on.We will use the analogues from typing package: typing.Tuple[...], typing.List[...] and typing.Set[...].
1 parentda2c493 commit1618d7c

File tree

6 files changed

+30
-22
lines changed

6 files changed

+30
-22
lines changed

‎testgres/operations/remote_ops.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
importtempfile
66
importio
77
importlogging
8+
importtyping
89

910
from ..exceptionsimportExecUtilException
1011
from ..exceptionsimportInvalidOperationException
@@ -669,8 +670,8 @@ def _is_port_free__process_1(error: str) -> bool:
669670
returnTrue
670671

671672
@staticmethod
672-
def_make_exec_env_list()->list[str]:
673-
result=list[str]()
673+
def_make_exec_env_list()->typing.List[str]:
674+
result:typing.List[str]=list()
674675
forenvvarinos.environ.items():
675676
ifnot__class__._does_put_envvar_into_exec_cmd(envvar[0]):
676677
continue

‎testgres/port_manager.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
importthreading
88
importrandom
9+
importtyping
910

1011

1112
classPortManager:
@@ -50,16 +51,16 @@ class PortManager__Generic(PortManager):
5051
_os_ops:OsOperations
5152
_guard:object
5253
# TODO: is there better to use bitmap fot _available_ports?
53-
_available_ports:set[int]
54-
_reserved_ports:set[int]
54+
_available_ports:typing.Set[int]
55+
_reserved_ports:typing.Set[int]
5556

5657
def__init__(self,os_ops:OsOperations):
5758
assertos_opsisnotNone
5859
assertisinstance(os_ops,OsOperations)
5960
self._os_ops=os_ops
6061
self._guard=threading.Lock()
61-
self._available_ports=set[int](range(1024,65535))
62-
self._reserved_ports=set[int]()
62+
self._available_ports:typing.Set[int]=set(range(1024,65535))
63+
self._reserved_ports:typing.Set[int]=set()
6364

6465
defreserve_port(self)->int:
6566
assertself._guardisnotNone

‎tests/conftest.py‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class TestConfigPropNames:
2626
TEST_CFG__LOG_DIR="TEST_CFG__LOG_DIR"
2727

2828

29+
# /////////////////////////////////////////////////////////////////////////////
30+
31+
T_TUPLE__str_int=typing.Tuple[str,int]
32+
2933
# /////////////////////////////////////////////////////////////////////////////
3034
# TestStartupData__Helper
3135

@@ -110,11 +114,11 @@ class TEST_PROCESS_STATS:
110114
cUnexpectedTests:int=0
111115
cAchtungTests:int=0
112116

113-
FailedTests=list[str,int]()
114-
XFailedTests=list[str,int]()
115-
NotXFailedTests=list[str]()
116-
WarningTests=list[str,int]()
117-
AchtungTests=list[str]()
117+
FailedTests:typing.List[T_TUPLE__str_int]=list()
118+
XFailedTests:typing.List[T_TUPLE__str_int]=list()
119+
NotXFailedTests:typing.List[str]=list()
120+
WarningTests:typing.List[T_TUPLE__str_int]=list()
121+
AchtungTests:typing.List[str]=list()
118122

119123
cTotalDuration:datetime.timedelta=datetime.timedelta()
120124

@@ -769,7 +773,7 @@ def helper__calc_W(n: int) -> int:
769773

770774

771775
# ------------------------------------------------------------------------
772-
defhelper__print_test_list(tests:list[str])->None:
776+
defhelper__print_test_list(tests:typing.List[str])->None:
773777
asserttype(tests)==list# noqa: E721
774778

775779
asserthelper__calc_W(9)==1
@@ -796,7 +800,7 @@ def helper__print_test_list(tests: list[str]) -> None:
796800

797801

798802
# ------------------------------------------------------------------------
799-
defhelper__print_test_list2(tests:list[str,int])->None:
803+
defhelper__print_test_list2(tests:typing.List[T_TUPLE__str_int])->None:
800804
asserttype(tests)==list# noqa: E721
801805

802806
asserthelper__calc_W(9)==1
@@ -843,7 +847,7 @@ def LOCAL__print_line1_with_header(header: str):
843847
assertheader!=""
844848
logging.info(C_LINE1+" ["+header+"]")
845849

846-
defLOCAL__print_test_list(header:str,test_count:int,test_list:list[str]):
850+
defLOCAL__print_test_list(header:str,test_count:int,test_list:typing.List[str]):
847851
asserttype(header)==str# noqa: E721
848852
asserttype(test_count)==int# noqa: E721
849853
asserttype(test_list)==list# noqa: E721
@@ -858,7 +862,7 @@ def LOCAL__print_test_list(header: str, test_count: int, test_list: list[str]):
858862
logging.info("")
859863

860864
defLOCAL__print_test_list2(
861-
header:str,test_count:int,test_list:list[str,int]
865+
header:str,test_count:int,test_list:typing.List[T_TUPLE__str_int]
862866
):
863867
asserttype(header)==str# noqa: E721
864868
asserttype(test_count)==int# noqa: E721

‎tests/test_os_ops_common.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
importlogging
1313
importsocket
1414
importthreading
15+
importtyping
1516

1617
from ..testgresimportInvalidOperationException
1718
from ..testgresimportExecUtilException
1819

1920

2021
classTestOsOpsCommon:
21-
sm_os_ops_descrs:list[OsOpsDescr]= [
22+
sm_os_ops_descrs:typing.List[OsOpsDescr]= [
2223
OsOpsDescrs.sm_local_os_ops_descr,
2324
OsOpsDescrs.sm_remote_os_ops_descr
2425
]

‎tests/test_testgres_common.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def removing(os_ops: OsOperations, f):
5656

5757

5858
classTestTestgresCommon:
59-
sm_node_svcs:list[PostgresNodeService]= [
59+
sm_node_svcs:typing.List[PostgresNodeService]= [
6060
PostgresNodeServices.sm_local,
6161
PostgresNodeServices.sm_local2,
6262
PostgresNodeServices.sm_remote,
@@ -315,8 +315,8 @@ def test_child_pids(self, node_svc: PostgresNodeService):
315315

316316
defLOCAL__test_auxiliary_pids(
317317
node:PostgresNode,
318-
expectedTypes:list[ProcessType]
319-
)->list[ProcessType]:
318+
expectedTypes:typing.List[ProcessType]
319+
)->typing.List[ProcessType]:
320320
# returns list of the absence processes
321321
assertnodeisnotNone
322322
asserttype(node)==PostgresNode# noqa: E721
@@ -327,15 +327,15 @@ def LOCAL__test_auxiliary_pids(
327327
assertpidsisnotNone# noqa: E721
328328
asserttype(pids)==dict# noqa: E721
329329

330-
result=list[ProcessType]()
330+
result:typing.List[ProcessType]=list()
331331
forptypeinexpectedTypes:
332332
ifnot (ptypeinpids):
333333
result.append(ptype)
334334
returnresult
335335

336336
defLOCAL__check_auxiliary_pids__multiple_attempts(
337337
node:PostgresNode,
338-
expectedTypes:list[ProcessType]):
338+
expectedTypes:typing.List[ProcessType]):
339339
assertnodeisnotNone
340340
asserttype(node)==PostgresNode# noqa: E721
341341
assertexpectedTypesisnotNone

‎tests/test_utils.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
from ..testgresimportscoped_config
88

99
importpytest
10+
importtyping
1011

1112

1213
classTestUtils:
13-
sm_os_ops_descrs:list[OsOpsDescr]= [
14+
sm_os_ops_descrs:typing.List[OsOpsDescr]= [
1415
OsOpsDescrs.sm_local_os_ops_descr,
1516
OsOpsDescrs.sm_remote_os_ops_descr
1617
]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp