File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,12 @@ def pytest_addoption(parser):
74
74
dest = "headless" ,
75
75
help = "Allow tests to run in headless" ,
76
76
)
77
+ parser .addoption (
78
+ "--use-lan-ip" ,
79
+ action = "store_true" ,
80
+ dest = "use_lan_ip" ,
81
+ help = "Whether to start test server with lan ip instead of localhost" ,
82
+ )
77
83
78
84
79
85
def pytest_ignore_collect (path , config ):
@@ -287,8 +293,10 @@ def wait_for_server(url, timeout):
287
293
288
294
289
295
@pytest .fixture (autouse = True , scope = "session" )
290
- def webserver ():
291
- webserver = SimpleWebServer (host = get_lan_ip ())
296
+ def webserver (request ):
297
+ host = get_lan_ip () if request .config .getoption ("use_lan_ip" ) else "0.0.0.0"
298
+
299
+ webserver = SimpleWebServer (host = host )
292
300
webserver .start ()
293
301
yield webserver
294
302
webserver .stop ()
You can’t perform that action at this time.
0 commit comments