diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 74cdf3ef..1d9cc020 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -47,7 +47,7 @@ jobs: sudo ln -s /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt # werkzeug is pinned for httpbin compatibility https://github.com/postmanlabs/httpbin/issues/673 - name: Install Python deps - run: pip install -U ${{ matrix.deps }} pytest 'pytest-asyncio>=0.23' pytest-httpbin pytest-rerunfailures structlog tomli platformdirs lxml jq 'werkzeug<2.1' awesomeversion + run: pip install -U ${{ matrix.deps }} pytest 'pytest-asyncio>=0.24' pytest-httpbin pytest-rerunfailures structlog tomli platformdirs lxml jq 'werkzeug<2.1' awesomeversion - name: Decrypt keys env: KEY: ${{ secrets.KEY }} diff --git a/pyproject.toml b/pyproject.toml index d9651f1e..b11b01f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,7 @@ build-backend = "setuptools.build_meta" [tool.pytest.ini_options] # addopts = -n auto asyncio_mode = "strict" +asyncio_default_fixture_loop_scope = "session" # build and upload # rm -rf dist && python -m build --no-isolation && twine check dist/* && twine upload dist/* diff --git a/tests/test_alpm.py b/tests/test_alpm.py index 862dda0f..870d061d 100644 --- a/tests/test_alpm.py +++ b/tests/test_alpm.py @@ -9,7 +9,7 @@ import pytest pytestmark = [ - pytest.mark.asyncio(scope="session"), + pytest.mark.asyncio, pytest.mark.skipif(shutil.which('makepkg') is None, reason='requires makepkg command'), pytest.mark.skipif(shutil.which('repo-add') is None, reason='requires repo-add command') ] diff --git a/tests/test_alpmfiles.py b/tests/test_alpmfiles.py index f27f9e79..de7c9c92 100644 --- a/tests/test_alpmfiles.py +++ b/tests/test_alpmfiles.py @@ -9,7 +9,7 @@ import pytest pytestmark = [ - pytest.mark.asyncio(scope="session"), + pytest.mark.asyncio, pytest.mark.skipif(shutil.which('pacman') is None, reason='requires pacman command'), pytest.mark.skipif(shutil.which('fakeroot') is None, reason='requires fakeroot command'), ] diff --git a/tests/test_android_sdk.py b/tests/test_android_sdk.py index a9485cbf..108fdf21 100644 --- a/tests/test_android_sdk.py +++ b/tests/test_android_sdk.py @@ -3,7 +3,7 @@ # Copyright (c) 2017 Chih-Hsuan Yen import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_android_addon(get_version): assert await get_version("android-google-play-apk-expansion", { diff --git a/tests/test_anitya.py b/tests/test_anitya.py index adeac41d..401a26b5 100644 --- a/tests/test_anitya.py +++ b/tests/test_anitya.py @@ -5,7 +5,7 @@ import re import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_anitya(get_version): version = await get_version("shutter", { diff --git a/tests/test_apt.py b/tests/test_apt.py index 030c165c..b561c7db 100644 --- a/tests/test_apt.py +++ b/tests/test_apt.py @@ -3,7 +3,7 @@ # Copyright (c) 2017 Felix Yan , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] @pytest.mark.flaky(reruns=10) async def test_apt(get_version): diff --git a/tests/test_archpkg.py b/tests/test_archpkg.py index 3f023289..6df3dc2c 100644 --- a/tests/test_archpkg.py +++ b/tests/test_archpkg.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] @pytest.mark.flaky async def test_archpkg(get_version): diff --git a/tests/test_aur.py b/tests/test_aur.py index 57a9f47c..1957825d 100644 --- a/tests/test_aur.py +++ b/tests/test_aur.py @@ -4,7 +4,7 @@ import os import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net, pytest.mark.skipif(os.environ.get('TRAVIS') == 'true', reason="fail too often")] diff --git a/tests/test_bitbucket.py b/tests/test_bitbucket.py index 084135ff..8efb01d7 100644 --- a/tests/test_bitbucket.py +++ b/tests/test_bitbucket.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_bitbucket(get_version): assert await get_version("example", { diff --git a/tests/test_cache.py b/tests/test_cache.py index 4076bccd..d64788b4 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -2,7 +2,7 @@ # Copyright (c) 2020 lilydjwg , et al. import pytest -pytestmark = pytest.mark.asyncio(scope="session") +pytestmark = pytest.mark.asyncio async def test_cache(run_str_multi): conf = r''' diff --git a/tests/test_cmd.py b/tests/test_cmd.py index 499ba47b..5f8a4644 100644 --- a/tests/test_cmd.py +++ b/tests/test_cmd.py @@ -3,7 +3,7 @@ import time import pytest -pytestmark = pytest.mark.asyncio(scope="session") +pytestmark = pytest.mark.asyncio async def test_cmd(get_version): assert await get_version("example", { diff --git a/tests/test_combiner.py b/tests/test_combiner.py index 85ee6994..21fcbf03 100644 --- a/tests/test_combiner.py +++ b/tests/test_combiner.py @@ -2,7 +2,7 @@ # Copyright (c) 2021 lilydjwg , et al. import pytest -pytestmark = pytest.mark.asyncio(scope="session") +pytestmark = pytest.mark.asyncio async def test_combiner(run_str_multi): conf = r''' diff --git a/tests/test_container.py b/tests/test_container.py index cdf6e470..d4c0cbe5 100644 --- a/tests/test_container.py +++ b/tests/test_container.py @@ -3,7 +3,7 @@ import pytest import datetime -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_container(get_version): assert await get_version("hello-world", { diff --git a/tests/test_cpan.py b/tests/test_cpan.py index d1e26c0c..ed1e488d 100644 --- a/tests/test_cpan.py +++ b/tests/test_cpan.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_cpan(get_version): assert await get_version("POE-Component-Server-HTTPServer", { diff --git a/tests/test_cran.py b/tests/test_cran.py index 88ff67f0..e3e4f714 100644 --- a/tests/test_cran.py +++ b/tests/test_cran.py @@ -2,7 +2,7 @@ # Copyright (c) 2022 Pekka Ristola , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_cran(get_version): assert await get_version("xml2", { diff --git a/tests/test_cratesio.py b/tests/test_cratesio.py index ee397c5b..f3d51639 100644 --- a/tests/test_cratesio.py +++ b/tests/test_cratesio.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_cratesio(get_version): assert await get_version("example", { diff --git a/tests/test_debianpkg.py b/tests/test_debianpkg.py index 03663379..376e0418 100644 --- a/tests/test_debianpkg.py +++ b/tests/test_debianpkg.py @@ -3,7 +3,7 @@ # Copyright (c) 2017 Felix Yan , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] @pytest.mark.flaky(reruns=10) async def test_debianpkg(get_version): diff --git a/tests/test_gems.py b/tests/test_gems.py index 7d914996..f51f1798 100644 --- a/tests/test_gems.py +++ b/tests/test_gems.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_gems(get_version): assert await get_version("example", { diff --git a/tests/test_git.py b/tests/test_git.py index fad66481..c570a020 100644 --- a/tests/test_git.py +++ b/tests/test_git.py @@ -2,7 +2,7 @@ # Copyright (c) 2020 Felix Yan , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_git(get_version): assert await get_version("example", { diff --git a/tests/test_gitea.py b/tests/test_gitea.py index 01c49ffc..bc2fbf82 100644 --- a/tests/test_gitea.py +++ b/tests/test_gitea.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] @pytest.mark.flaky(reruns=10) diff --git a/tests/test_github.py b/tests/test_github.py index c8f701c8..c936642c 100644 --- a/tests/test_github.py +++ b/tests/test_github.py @@ -5,7 +5,7 @@ import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net, pytest.mark.usefixtures('keyfile')] diff --git a/tests/test_gitlab.py b/tests/test_gitlab.py index d5da1790..6afce5ae 100644 --- a/tests/test_gitlab.py +++ b/tests/test_gitlab.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_gitlab(get_version): ver = await get_version("example", { diff --git a/tests/test_go.py b/tests/test_go.py index 9151de4a..0d167788 100644 --- a/tests/test_go.py +++ b/tests/test_go.py @@ -12,7 +12,7 @@ lxml_available = False pytestmark = [ - pytest.mark.asyncio(scope="session"), + pytest.mark.asyncio, pytest.mark.needs_net, pytest.mark.skipif(not lxml_available, reason="needs lxml") ] diff --git a/tests/test_hackage.py b/tests/test_hackage.py index 2a7d0e09..4fedc106 100644 --- a/tests/test_hackage.py +++ b/tests/test_hackage.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] @pytest.mark.flaky(reruns=10) async def test_hackage(get_version): diff --git a/tests/test_htmlparser.py b/tests/test_htmlparser.py index 69ec1178..aed9f737 100644 --- a/tests/test_htmlparser.py +++ b/tests/test_htmlparser.py @@ -10,7 +10,7 @@ lxml_available = False pytestmark = [ - pytest.mark.asyncio(scope="session"), + pytest.mark.asyncio, pytest.mark.needs_net, pytest.mark.skipif(not lxml_available, reason="needs lxml"), ] diff --git a/tests/test_httpheader.py b/tests/test_httpheader.py index 7fe0e536..6d599823 100644 --- a/tests/test_httpheader.py +++ b/tests/test_httpheader.py @@ -10,7 +10,7 @@ except ImportError: httpbin_available = False -pytestmark = pytest.mark.asyncio(scope="session") +pytestmark = pytest.mark.asyncio @pytest.mark.needs_net async def test_redirection(get_version): diff --git a/tests/test_jq.py b/tests/test_jq.py index 20b33110..a83268da 100644 --- a/tests/test_jq.py +++ b/tests/test_jq.py @@ -10,7 +10,7 @@ jq_available = False pytestmark = [ - pytest.mark.asyncio(scope="session"), + pytest.mark.asyncio, pytest.mark.needs_net, pytest.mark.skipif(not jq_available, reason="needs jq"), ] diff --git a/tests/test_launchpad.py b/tests/test_launchpad.py index 090c1263..6184b5d8 100644 --- a/tests/test_launchpad.py +++ b/tests/test_launchpad.py @@ -1,7 +1,7 @@ # MIT Licensed # Copyright (c) 2024 Bert Peters , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_launchpad(get_version): version = await get_version( diff --git a/tests/test_manual.py b/tests/test_manual.py index 0ceeadba..1818832b 100644 --- a/tests/test_manual.py +++ b/tests/test_manual.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = pytest.mark.asyncio(scope="session") +pytestmark = pytest.mark.asyncio async def test_manual(get_version): assert await get_version("example", { diff --git a/tests/test_mercurial.py b/tests/test_mercurial.py index e35d4c7f..4e8a42a7 100644 --- a/tests/test_mercurial.py +++ b/tests/test_mercurial.py @@ -3,7 +3,7 @@ import pytest pytestmark = [ - pytest.mark.asyncio(scope="session"), + pytest.mark.asyncio, pytest.mark.needs_net, ] diff --git a/tests/test_npm.py b/tests/test_npm.py index b1aea02f..2e11385b 100644 --- a/tests/test_npm.py +++ b/tests/test_npm.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_npm(get_version): assert await get_version("example", { diff --git a/tests/test_openvsx.py b/tests/test_openvsx.py index ae7e08bc..8ce80db0 100644 --- a/tests/test_openvsx.py +++ b/tests/test_openvsx.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2021 Th3Whit3Wolf , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_openvsx(get_version): assert await get_version("usernamehw.indent-one-space", { diff --git a/tests/test_packagist.py b/tests/test_packagist.py index c48fae61..71f005ef 100644 --- a/tests/test_packagist.py +++ b/tests/test_packagist.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_packagist(get_version): assert await get_version("butterfly/example-web-application", { diff --git a/tests/test_pacman.py b/tests/test_pacman.py index 58c397cf..377b1770 100644 --- a/tests/test_pacman.py +++ b/tests/test_pacman.py @@ -4,7 +4,7 @@ import pathlib import shutil import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), +pytestmark = [pytest.mark.asyncio, pytest.mark.skipif(shutil.which("pacman") is None, reason="requires pacman command"), pytest.mark.skipif(not pathlib.Path("/var/lib/pacman/sync/core.db").exists(), diff --git a/tests/test_pagure.py b/tests/test_pagure.py index 9282aa62..daeb966b 100644 --- a/tests/test_pagure.py +++ b/tests/test_pagure.py @@ -2,7 +2,7 @@ # Copyright (c) 2020 Felix Yan , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_pagure(get_version): ver = await get_version("example", { diff --git a/tests/test_pypi.py b/tests/test_pypi.py index 03fecd27..1d6643c5 100644 --- a/tests/test_pypi.py +++ b/tests/test_pypi.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_pypi(get_version): assert await get_version("example", { diff --git a/tests/test_regex.py b/tests/test_regex.py index 941d4411..b7f2e3d9 100644 --- a/tests/test_regex.py +++ b/tests/test_regex.py @@ -13,7 +13,7 @@ httpbin_available = False pytestmark = [ - pytest.mark.asyncio(scope="session"), + pytest.mark.asyncio, pytest.mark.skipif(not httpbin_available, reason="needs pytest_httpbin"), ] diff --git a/tests/test_repology.py b/tests/test_repology.py index c2f15cfa..c4110e35 100644 --- a/tests/test_repology.py +++ b/tests/test_repology.py @@ -2,7 +2,7 @@ # Copyright (c) 2019-2020 lilydjwg , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] @pytest.mark.flaky(reruns=10) diff --git a/tests/test_sparkle.py b/tests/test_sparkle.py index c68a7e16..88446a8d 100644 --- a/tests/test_sparkle.py +++ b/tests/test_sparkle.py @@ -3,7 +3,7 @@ # Copyright (c) 2020 Sunlei import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_sparkle(get_version): assert await get_version('example', { diff --git a/tests/test_substitute.py b/tests/test_substitute.py index 1cdf9c64..f8c8fc1e 100644 --- a/tests/test_substitute.py +++ b/tests/test_substitute.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2020 lilydjwg , et al. import pytest -pytestmark = pytest.mark.asyncio(scope="session") +pytestmark = pytest.mark.asyncio async def test_substitute_prefix(get_version): assert await get_version("example", { diff --git a/tests/test_ubuntupkg.py b/tests/test_ubuntupkg.py index 9a0de7be..8622896b 100644 --- a/tests/test_ubuntupkg.py +++ b/tests/test_ubuntupkg.py @@ -3,7 +3,7 @@ # Copyright (c) 2017 Felix Yan , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] @pytest.mark.flaky async def test_ubuntupkg(get_version): diff --git a/tests/test_vsmarketplace.py b/tests/test_vsmarketplace.py index f03b450a..1a14081e 100644 --- a/tests/test_vsmarketplace.py +++ b/tests/test_vsmarketplace.py @@ -2,7 +2,7 @@ # Copyright (c) 2013-2021 Th3Whit3Wolf , et al. import pytest -pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net] +pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_vsmarketplace(get_version): assert await get_version("usernamehw.indent-one-space", {