From b8cc949e0e20c5588ee77476f5b4e33829ae7526 Mon Sep 17 00:00:00 2001 From: Dima Tisnek Date: Tue, 19 Nov 2024 16:14:17 +0900 Subject: [PATCH 1/3] chore: set the asyncio default before deprecation --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index e55113be8..ad6b9e6ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -216,3 +216,6 @@ pythonVersion = "3.8" typeCheckingMode = "strict" useLibraryCodeForTypes = true reportGeneralTypeIssues = true + +[tool.pytest.ini_options] +asyncio_default_fixture_loop_scope = "function" From df4a1e0fe8e6667459d45c5049074de9ef0e8143 Mon Sep 17 00:00:00 2001 From: Dima Tisnek Date: Wed, 20 Nov 2024 11:04:30 +0900 Subject: [PATCH 2/3] chore: move pytest config from tox.ini to pyproject.toml --- pyproject.toml | 8 ++++++++ tox.ini | 24 ++++++------------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ad6b9e6ae..722cbf920 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -218,4 +218,12 @@ useLibraryCodeForTypes = true reportGeneralTypeIssues = true [tool.pytest.ini_options] +addopts = "-ra -v" asyncio_default_fixture_loop_scope = "function" +asyncio_mode = "auto" +filterwarnings = "ignore::DeprecationWarning:websockets" +markers = [ + "serial: mark a test that must run by itself", + "wait_for_idle: mark a test that waits for the model to be idle", + "bundle: mark a test that uses a bundle", +] diff --git a/tox.ini b/tox.ini index db3bf4ff8..0e97e6c8e 100644 --- a/tox.ini +++ b/tox.ini @@ -8,21 +8,12 @@ envlist = py3,py38,py39,py310,py311,docs skipsdist=True -[pytest] -markers = - serial: mark a test that must run by itself - wait_for_idle: mark a test that waits for the model to be idle - bundle: mark a test that uses a bundle -asyncio_mode = auto -filterwarnings = - ignore::DeprecationWarning:websockets - [testenv] usedevelop=True commands = pip install urllib3<2 pip install pylxd - python -m pytest --tb native -ra -v -s -k 'not integration' -m 'not serial' {posargs} + pytest --tb native -s -k 'not integration' -m 'not serial' {posargs} passenv = HOME TEST_AGENTS @@ -33,7 +24,6 @@ deps = typing-inspect paramiko ipdb - mock pytest pytest-asyncio Twine @@ -57,9 +47,8 @@ envdir = {toxworkdir}/py3 commands = pip install urllib3<2 pip install pylxd - python -m pytest \ + pytest \ --tb native \ - -ra -v \ -k 'integration' \ --ignore {toxinidir}/tests/integration/test_crossmodel.py \ --ignore {toxinidir}/tests/integration/test_model.py \ @@ -71,9 +60,8 @@ envdir = {toxworkdir}/py3 commands = pip install urllib3<2 pip install pylxd - python -m pytest \ + pytest \ --tb native \ - -ra -v \ -m 'not serial' \ {posargs} \ {toxinidir}/tests/integration/test_crossmodel.py \ @@ -84,7 +72,7 @@ envdir = {toxworkdir}/py3 commands = pip install urllib3<2 pip install pylxd - python -m pytest --tb native -ra -v {toxinidir}/tests/unit {posargs} + pytest {toxinidir}/tests/unit {posargs} [testenv:serial] # tests that can't be run in parallel @@ -94,11 +82,11 @@ envdir = {toxworkdir}/py3 commands = pip install urllib3<2 pip install pylxd - python -m pytest --tb native -ra -v -s {posargs:-m 'serial'} + pytest --tb native -s {posargs:-m 'serial'} [testenv:validate] envdir = {toxworkdir}/validate -commands = python -m pytest --tb native -ra -vv tests/validate +commands = pytest -vvv tests/validate [testenv:example] envdir = {toxworkdir}/py3 From 03c1bb7e83fde950455a66c0e2603f5c26b6d2d5 Mon Sep 17 00:00:00 2001 From: Dima Tisnek Date: Wed, 20 Nov 2024 11:40:54 +0900 Subject: [PATCH 3/3] chore: make tests.validate a module --- tests/validate/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/validate/__init__.py diff --git a/tests/validate/__init__.py b/tests/validate/__init__.py new file mode 100644 index 000000000..e69de29bb