1010import  os 
1111from  pathlib  import  Path 
1212import  xml .etree .ElementTree  as  ET 
13- from  typing  import  Callable , Optional 
13+ from  typing  import  Callable , Optional ,  Union ,  Dict ,  Any ,  List 
1414from  opengeodeweb_viewer  import  config 
1515from  opengeodeweb_microservice .database .connection  import  get_session , init_database 
1616from  opengeodeweb_microservice .database .data  import  Data 
1717
1818
1919class  ServerMonitor :
20-     def  __init__ (self , log ) :
20+     def  __init__ (self , log :  str )  ->   None :
2121        self .log  =  log 
2222        self .ws  =  create_connection ("ws://localhost:1234/ws" )
2323        self .images_dir_path  =  os .path .abspath (
@@ -31,7 +31,7 @@ def __init__(self, log):
3131        self ._init_ws ()
3232        self ._drain_initial_messages ()
3333
34-     def  call (self , rpc , params = [{}]) ->  None :
34+     def  call (self , rpc :  str , params :  List [ Dict [ str ,  Any ]]  =   [{}]) ->  None :
3535        return  self .ws .send (
3636            json .dumps (
3737                {
@@ -42,7 +42,7 @@ def call(self, rpc, params=[{}]) -> None:
4242            )
4343        )
4444
45-     def  print_log (self ):
45+     def  print_log (self )  ->   None :
4646        output  =  "" 
4747        with  open (self .log ) as  f :
4848            for  line  in  f :
@@ -52,7 +52,7 @@ def print_log(self):
5252                output  +=  line 
5353        print (output )
5454
55-     def  get_response (self ):
55+     def  get_response (self )  ->   Union [ bytes ,  Dict [ str ,  Any ],  str ] :
5656        response  =  self .ws .recv ()
5757        if  isinstance (response , bytes ):
5858            return  response 
@@ -144,10 +144,10 @@ def _drain_initial_messages(
144144
145145
146146class  FixtureHelper :
147-     def  __init__ (self , root_path ) :
147+     def  __init__ (self , root_path :  Path )  ->   None :
148148        self .root_path  =  Path (root_path )
149149
150-     def  get_xprocess_args (self ):
150+     def  get_xprocess_args (self )  ->   tuple :
151151        class  Starter (ProcessStarter ):
152152            terminate_on_interrupt  =  True 
153153            pattern  =  "wslink: Starting factory" 
@@ -166,7 +166,7 @@ class Starter(ProcessStarter):
166166
167167
168168@pytest .fixture  
169- def  server (xprocess ):
169+ def  server (xprocess )  ->   ServerMonitor :
170170    name , Starter , Monitor  =  HELPER .get_xprocess_args ()
171171    os .environ ["PYTHON_ENV" ] =  "test" 
172172    _ , log  =  xprocess .ensure (name , Starter )
@@ -181,7 +181,7 @@ def server(xprocess):
181181
182182
183183@pytest .fixture (scope = "session" , autouse = True ) 
184- def  configure_test_environment ():
184+ def  configure_test_environment ()  ->   None :
185185    base_path  =  Path (__file__ ).parent 
186186    config .test_config (base_path )
187187    db_path  =  base_path  /  "project.db" 
@@ -197,7 +197,6 @@ def configure_test_environment():
197197
198198@pytest .fixture  
199199def  dataset_factory () ->  Callable [..., str ]:
200- 
201200    def  create_dataset (
202201        * , id : str , viewable_file_name : str , geode_object : Optional [str ] =  None 
203202    ) ->  str :
0 commit comments