diff --git a/pdm.lock b/pdm.lock index 085f758..4277c01 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev"] strategy = ["cross_platform"] lock_version = "4.4" -content_hash = "sha256:e7d6cb114e204bce0c787f389da975161baf9e702ac1f42acb1c4946dcef3670" +content_hash = "sha256:24c0c9f544f05e7b6e88f90539413e19951fecb6db9e899d05f62e4547132997" [[package]] name = "appnope" diff --git a/pyproject.toml b/pyproject.toml index c71c417..6b884c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,11 @@ Source = "https://github.com/m9810223/playwright-async-pytest" distribution = true [tool.pdm.dev-dependencies] -dev = ["pytest>=7.4.0", "ipython>=8.12.2", "nest-asyncio>=1.5.6"] +dev = [ + "pytest>=7.4.0", + "ipython>=8.12.2", + "nest-asyncio>=1.6.0", +] [tool.pdm.scripts] test = "pytest" @@ -73,4 +77,4 @@ known-local-folder = [] ignore_missing_imports = true [tool.pytest.ini_options] -addopts = "--exitfirst --failed-first -r fEsxXp --disable-warnings --showlocals --tb=short" +addopts = "--exitfirst --failed-first -r fEsxXp --showlocals --tb=short" diff --git a/tests/conftest.py b/tests/conftest.py index c5782f4..59fd67a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ import asyncio +import nest_asyncio import pytest_asyncio @@ -7,5 +8,6 @@ def event_loop(): # https://pytest-asyncio.readthedocs.io/en/latest/reference/fixtures.html#fixtures policy = asyncio.get_event_loop_policy() loop = policy.new_event_loop() + nest_asyncio.apply(loop) yield loop loop.close() diff --git a/tests/test_with_sync.py b/tests/test_with_sync.py new file mode 100644 index 0000000..a3a3174 --- /dev/null +++ b/tests/test_with_sync.py @@ -0,0 +1,6 @@ +from playwright.sync_api import Page as SPage + + +def test_sync_api(page: SPage): + # access webpage + page.goto('https://playwright.dev/')