@@ -133,8 +133,6 @@ class _06_load_json_argv_with_data_via_localhost_8000_in_setup_teardown(_03_load
133133
134134 # CAREFUL : localhost not always recognized, better to use 127.0.0.1
135135 # Port 0 can also be used and means to select an arbitrary unused port
136- # HOST, PORT = "127.0.0.1", 8000
137- # server_adr = f"http://{HOST}:{PORT}/"
138136 HOST , PORT = "127.0.0.1" , 0
139137 server_adr = ''
140138 # Open a HTTP server to access to the current directory
@@ -150,8 +148,6 @@ def setUp(self) -> None:
150148 server_thread .daemon = True
151149 server_thread .start ()
152150 self .httpd_address , self .httpd_port = self .httpd .server_address
153- self .httpd_url = f"http://{ self .httpd_address } :{ self .httpd_port } "
154- print (f"Server URL = { self .httpd_url } " )
155151 self .server_adr = f"http://{ self .httpd_address } :{ self .httpd_port } /"
156152 print (f"\n \n Connection to { self .server_adr } in { server_thread .name } " , end = ' ' )
157153
@@ -170,7 +166,7 @@ class _07_load_json_argv_with_data_via_localhost_8000_in_fixture(_03_load_json_a
170166 # This is launched as Thread and need the Thread Server Handler
171167
172168 # CAREFUL : localhost not always recognized, better to use 127.0.0.1
173- # Port 0 can also be used and means to select an arbitrary unused port
169+ # Port fixed at 8000 before to use the fixture because some issues appears with thread
174170 HOST , PORT = "127.0.0.1" , 8000
175171 server_adr = f"http://{ HOST } :{ PORT } /"
176172 Handler = http .server .SimpleHTTPRequestHandler # Open a HTTP server to access to the current directory
@@ -186,17 +182,13 @@ def HTTPServer_Connection(self):
186182 self .httpd = ThreadedTCPServer ((self .HOST , self .PORT ), self .Handler )
187183 if self .httpd :
188184 # ip, port = self.httpd.server_address
189- # self.server_adr = f"http://{ip}:{port}/"\ # Careful : issues with properties in thread using fixtures
185+ # self.server_adr = f"http://{ip}:{port}/"\ # Careful : Do not initialize an attribute here
190186
191187 # Start a thread with the server
192188 server_thread = threading .Thread (target = self .httpd .serve_forever )
193189 # Exit the server thread when the main thread terminates
194190 server_thread .daemon = True
195191 server_thread .start ()
196- # self.httpd_address, self.httpd_port = self.httpd.server_address
197- # self.httpd_url = f"http://{self.httpd_address}:{self.httpd_port}"
198- # print(f"Server URL = {self.httpd_url}")
199- # self.server_adr = f"http://{self.httpd_address}:{self.httpd_port}/"
200192 print (f"\n \n HTTP Connection to { self .server_adr } in { server_thread .name } " , end = ' ' )
201193
202194 def HTTPServer_Disconnection (self ):
@@ -210,8 +202,6 @@ def HTTPServer_Disconnection(self):
210202class _08_load_json_argv_with_data_via_localhost_8000_in_setupClass_teardownClass (_03_load_json_argv_with_file_in_folder ):
211203 # CAREFUL : localhost not always recognized, better to use 127.0.0.1
212204 # Port 0 can also be used and means to select an arbitrary unused port
213- # HOST, PORT = "127.0.0.1", 8000
214- # server_adr = f"http://{HOST}:{PORT}/"
215205 HOST , PORT = "127.0.0.1" , 0
216206 server_adr = ''
217207 # Open a HTTP server to access to the current directory
@@ -229,8 +219,6 @@ def setUpClass(cls) -> None:
229219 server_thread .daemon = True
230220 server_thread .start ()
231221 cls .httpd_address , cls .httpd_port = cls .httpd .server_address
232- cls .httpd_url = f"http://{ cls .httpd_address } :{ cls .httpd_port } "
233- print (f"Server URL = { cls .httpd_url } " )
234222 cls .server_adr = f"http://{ cls .httpd_address } :{ cls .httpd_port } /"
235223 print (f"\n \n Connection to { cls .server_adr } in { server_thread .name } " , end = ' ' )
236224
0 commit comments