Skip to content

Commit 89b4cd9

Browse files
committed
tests: use asyncio_default_fixture_loop_scope = "session"
See also pytest-dev/pytest-asyncio#924.
1 parent 4eb70a0 commit 89b4cd9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+43
-42
lines changed

.github/workflows/tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
sudo ln -s /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt
4848
# werkzeug is pinned for httpbin compatibility https://github.com/postmanlabs/httpbin/issues/673
4949
- name: Install Python deps
50-
run: pip install -U ${{ matrix.deps }} pytest 'pytest-asyncio>=0.23' pytest-httpbin pytest-rerunfailures structlog tomli platformdirs lxml jq 'werkzeug<2.1' awesomeversion
50+
run: pip install -U ${{ matrix.deps }} pytest 'pytest-asyncio>=0.24' pytest-httpbin pytest-rerunfailures structlog tomli platformdirs lxml jq 'werkzeug<2.1' awesomeversion
5151
- name: Decrypt keys
5252
env:
5353
KEY: ${{ secrets.KEY }}

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ build-backend = "setuptools.build_meta"
55
[tool.pytest.ini_options]
66
# addopts = -n auto
77
asyncio_mode = "strict"
8+
asyncio_default_fixture_loop_scope = "session"
89

910
# build and upload
1011
# rm -rf dist && python -m build --no-isolation && twine check dist/* && twine upload dist/*

tests/test_alpm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pytest
1010

1111
pytestmark = [
12-
pytest.mark.asyncio(scope="session"),
12+
pytest.mark.asyncio,
1313
pytest.mark.skipif(shutil.which('makepkg') is None, reason='requires makepkg command'),
1414
pytest.mark.skipif(shutil.which('repo-add') is None, reason='requires repo-add command')
1515
]

tests/test_alpmfiles.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pytest
1010

1111
pytestmark = [
12-
pytest.mark.asyncio(scope="session"),
12+
pytest.mark.asyncio,
1313
pytest.mark.skipif(shutil.which('pacman') is None, reason='requires pacman command'),
1414
pytest.mark.skipif(shutil.which('fakeroot') is None, reason='requires fakeroot command'),
1515
]

tests/test_android_sdk.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2017 Chih-Hsuan Yen <yan12125 at gmail dot com>
44

55
import pytest
6-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
6+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
77

88
async def test_android_addon(get_version):
99
assert await get_version("android-google-play-apk-expansion", {

tests/test_anitya.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import re
66

77
import pytest
8-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
8+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
99

1010
async def test_anitya(get_version):
1111
version = await get_version("shutter", {

tests/test_apt.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2017 Felix Yan <[email protected]>, et al.
44

55
import pytest
6-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
6+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
77

88
@pytest.mark.flaky(reruns=10)
99
async def test_apt(get_version):

tests/test_archpkg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
@pytest.mark.flaky
88
async def test_archpkg(get_version):

tests/test_aur.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55

66
import pytest
7-
pytestmark = [pytest.mark.asyncio(scope="session"),
7+
pytestmark = [pytest.mark.asyncio,
88
pytest.mark.needs_net,
99
pytest.mark.skipif(os.environ.get('TRAVIS') == 'true',
1010
reason="fail too often")]

tests/test_bitbucket.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_bitbucket(get_version):
88
assert await get_version("example", {

tests/test_cache.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = pytest.mark.asyncio(scope="session")
5+
pytestmark = pytest.mark.asyncio
66

77
async def test_cache(run_str_multi):
88
conf = r'''

tests/test_cmd.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import time
55
import pytest
6-
pytestmark = pytest.mark.asyncio(scope="session")
6+
pytestmark = pytest.mark.asyncio
77

88
async def test_cmd(get_version):
99
assert await get_version("example", {

tests/test_combiner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2021 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = pytest.mark.asyncio(scope="session")
5+
pytestmark = pytest.mark.asyncio
66

77
async def test_combiner(run_str_multi):
88
conf = r'''

tests/test_container.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55
import datetime
6-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
6+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
77

88
async def test_container(get_version):
99
assert await get_version("hello-world", {

tests/test_cpan.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_cpan(get_version):
88
assert await get_version("POE-Component-Server-HTTPServer", {

tests/test_cran.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2022 Pekka Ristola <pekkarr [at] protonmail [dot] com>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_cran(get_version):
88
assert await get_version("xml2", {

tests/test_cratesio.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_cratesio(get_version):
88
assert await get_version("example", {

tests/test_debianpkg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2017 Felix Yan <[email protected]>, et al.
44

55
import pytest
6-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
6+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
77

88
@pytest.mark.flaky(reruns=10)
99
async def test_debianpkg(get_version):

tests/test_gems.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_gems(get_version):
88
assert await get_version("example", {

tests/test_git.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2020 Felix Yan <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_git(get_version):
88
assert await get_version("example", {

tests/test_gitea.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"),
5+
pytestmark = [pytest.mark.asyncio,
66
pytest.mark.needs_net]
77

88
@pytest.mark.flaky(reruns=10)

tests/test_github.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import pytest
77

8-
pytestmark = [pytest.mark.asyncio(scope="session"),
8+
pytestmark = [pytest.mark.asyncio,
99
pytest.mark.needs_net,
1010
pytest.mark.usefixtures('keyfile')]
1111

tests/test_gitlab.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_gitlab(get_version):
88
ver = await get_version("example", {

tests/test_go.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
lxml_available = False
1313

1414
pytestmark = [
15-
pytest.mark.asyncio(scope="session"),
15+
pytest.mark.asyncio,
1616
pytest.mark.needs_net,
1717
pytest.mark.skipif(not lxml_available, reason="needs lxml")
1818
]

tests/test_hackage.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
@pytest.mark.flaky(reruns=10)
88
async def test_hackage(get_version):

tests/test_htmlparser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
lxml_available = False
1111

1212
pytestmark = [
13-
pytest.mark.asyncio(scope="session"),
13+
pytest.mark.asyncio,
1414
pytest.mark.needs_net,
1515
pytest.mark.skipif(not lxml_available, reason="needs lxml"),
1616
]

tests/test_httpheader.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
except ImportError:
1111
httpbin_available = False
1212

13-
pytestmark = pytest.mark.asyncio(scope="session")
13+
pytestmark = pytest.mark.asyncio
1414

1515
@pytest.mark.needs_net
1616
async def test_redirection(get_version):

tests/test_jq.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
jq_available = False
1111

1212
pytestmark = [
13-
pytest.mark.asyncio(scope="session"),
13+
pytest.mark.asyncio,
1414
pytest.mark.needs_net,
1515
pytest.mark.skipif(not jq_available, reason="needs jq"),
1616
]

tests/test_launchpad.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# MIT Licensed
22
# Copyright (c) 2024 Bert Peters <[email protected]>, et al.
33
import pytest
4-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
4+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
55

66
async def test_launchpad(get_version):
77
version = await get_version(

tests/test_manual.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = pytest.mark.asyncio(scope="session")
5+
pytestmark = pytest.mark.asyncio
66

77
async def test_manual(get_version):
88
assert await get_version("example", {

tests/test_mercurial.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55
pytestmark = [
6-
pytest.mark.asyncio(scope="session"),
6+
pytest.mark.asyncio,
77
pytest.mark.needs_net,
88
]
99

tests/test_npm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_npm(get_version):
88
assert await get_version("example", {

tests/test_openvsx.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2021 Th3Whit3Wolf <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_openvsx(get_version):
88
assert await get_version("usernamehw.indent-one-space", {

tests/test_packagist.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_packagist(get_version):
88
assert await get_version("butterfly/example-web-application", {

tests/test_pacman.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pathlib
55
import shutil
66
import pytest
7-
pytestmark = [pytest.mark.asyncio(scope="session"),
7+
pytestmark = [pytest.mark.asyncio,
88
pytest.mark.skipif(shutil.which("pacman") is None,
99
reason="requires pacman command"),
1010
pytest.mark.skipif(not pathlib.Path("/var/lib/pacman/sync/core.db").exists(),

tests/test_pagure.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2020 Felix Yan <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_pagure(get_version):
88
ver = await get_version("example", {

tests/test_pypi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_pypi(get_version):
88
assert await get_version("example", {

tests/test_regex.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
httpbin_available = False
1414

1515
pytestmark = [
16-
pytest.mark.asyncio(scope="session"),
16+
pytest.mark.asyncio,
1717
pytest.mark.skipif(not httpbin_available, reason="needs pytest_httpbin"),
1818
]
1919

tests/test_repology.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2019-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"),
5+
pytestmark = [pytest.mark.asyncio,
66
pytest.mark.needs_net]
77

88
@pytest.mark.flaky(reruns=10)

tests/test_sparkle.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2020 Sunlei <[email protected]>
44

55
import pytest
6-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
6+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
77

88
async def test_sparkle(get_version):
99
assert await get_version('example', {

tests/test_substitute.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2020 lilydjwg <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = pytest.mark.asyncio(scope="session")
5+
pytestmark = pytest.mark.asyncio
66

77
async def test_substitute_prefix(get_version):
88
assert await get_version("example", {

tests/test_ubuntupkg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2017 Felix Yan <[email protected]>, et al.
44

55
import pytest
6-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
6+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
77

88
@pytest.mark.flaky
99
async def test_ubuntupkg(get_version):

tests/test_vsmarketplace.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2013-2021 Th3Whit3Wolf <[email protected]>, et al.
33

44
import pytest
5-
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
5+
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
66

77
async def test_vsmarketplace(get_version):
88
assert await get_version("usernamehw.indent-one-space", {

0 commit comments

Comments
 (0)