fix test_scrape_web_page error

This commit is contained in:
shenchucheng 2024-01-15 13:20:13 +08:00
parent 9d1df5acd5
commit 7c3ac6a350
5 changed files with 7 additions and 7 deletions

View file

@ -127,7 +127,7 @@ def proxy():
server = await asyncio.start_server(handle_client, "127.0.0.1", 0)
return server, "http://{}:{}".format(*server.sockets[0].getsockname())
return proxy_func()
return proxy_func
# see https://github.com/Delgan/loguru/issues/59#issuecomment-466591978

View file

@ -22,8 +22,8 @@ async def test_scrape_web_page(browser_type, use_proxy, kwagrs, url, urls, proxy
global_proxy = config.proxy
try:
if use_proxy:
server, proxy = await proxy
config.proxy = proxy
server, proxy_url = await proxy()
config.proxy = proxy_url
browser = web_browser_engine_playwright.PlaywrightWrapper(browser_type=browser_type, **kwagrs)
result = await browser.run(url)
assert isinstance(result, WebPage)

View file

@ -25,8 +25,8 @@ async def test_scrape_web_page(browser_type, use_proxy, url, urls, proxy, capfd)
global_proxy = config.proxy
try:
if use_proxy:
server, proxy = await proxy
config.proxy = proxy
server, proxy_url = await proxy()
config.proxy = proxy_url
browser = web_browser_engine_selenium.SeleniumWrapper(browser_type=browser_type)
result = await browser.run(url)
assert isinstance(result, WebPage)