mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Test improvements and fixed deprecation warnings (#2464)
* `asyncio_default_fixture_loop_scope = function` * Fix a bunch of BeautifulSoup deprecation warnings * Fix for PytestUnraisableExceptionWarning: Exception ignored in: <_io.FileIO [closed]> * xfail for sql_time_limit tests (these can be flaky in CI) Refs #2461
This commit is contained in:
parent
962da77d61
commit
53a3b3c80e
11 changed files with 49 additions and 44 deletions
|
|
@ -113,7 +113,7 @@ async def test_hook_plugin_prepare_connection_arguments(ds_client):
|
|||
async def test_hook_extra_css_urls(ds_client, path, expected_decoded_object):
|
||||
response = await ds_client.get(path)
|
||||
assert response.status_code == 200
|
||||
links = Soup(response.text, "html.parser").findAll("link")
|
||||
links = Soup(response.text, "html.parser").find_all("link")
|
||||
special_href = [
|
||||
link
|
||||
for link in links
|
||||
|
|
@ -128,7 +128,7 @@ async def test_hook_extra_css_urls(ds_client, path, expected_decoded_object):
|
|||
@pytest.mark.asyncio
|
||||
async def test_hook_extra_js_urls(ds_client):
|
||||
response = await ds_client.get("/")
|
||||
scripts = Soup(response.text, "html.parser").findAll("script")
|
||||
scripts = Soup(response.text, "html.parser").find_all("script")
|
||||
script_attrs = [s.attrs for s in scripts]
|
||||
for attrs in [
|
||||
{
|
||||
|
|
@ -153,7 +153,7 @@ async def test_plugins_with_duplicate_js_urls(ds_client):
|
|||
# What matters is that https://plugin-example.datasette.io/jquery.js is only there once
|
||||
# and it comes before plugin1.js and plugin2.js which could be in either
|
||||
# order
|
||||
scripts = Soup(response.text, "html.parser").findAll("script")
|
||||
scripts = Soup(response.text, "html.parser").find_all("script")
|
||||
srcs = [s["src"] for s in scripts if s.get("src")]
|
||||
# No duplicates allowed:
|
||||
assert len(srcs) == len(set(srcs))
|
||||
|
|
@ -541,7 +541,7 @@ async def test_hook_register_output_renderer_can_render(ds_client):
|
|||
links = (
|
||||
Soup(response.text, "html.parser")
|
||||
.find("p", {"class": "export-links"})
|
||||
.findAll("a")
|
||||
.find_all("a")
|
||||
)
|
||||
actual = [link["href"] for link in links]
|
||||
# Should not be present because we sent ?_no_can_render=1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue