diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/docs/reference.md b/docs/reference.md old mode 100644 new mode 100755 diff --git a/pytest_operator/__init__.py b/pytest_operator/__init__.py old mode 100644 new mode 100755 diff --git a/pytest_operator/plugin.py b/pytest_operator/plugin.py old mode 100644 new mode 100755 index 09ff21d..df6a526 --- a/pytest_operator/plugin.py +++ b/pytest_operator/plugin.py @@ -149,6 +149,8 @@ def tmp_path_factory(request): given_basetemp=Path(os.environ["TOX_ENV_DIR"]) / "tmp" / "pytest", trace=request.config.trace.get("tmpdir"), _ispytest=True, + retention_count=1, + retention_policy="failed" ) @@ -167,25 +169,13 @@ def check_deps(*deps): ) -@pytest.fixture(scope="module") -def event_loop(): - """Create an instance of the default event loop for each test module.""" - loop = asyncio.get_event_loop_policy().new_event_loop() - yield loop - loop.close() - - -# Plugin load order can't be set, replace asyncio directly -pytest_asyncio.plugin.event_loop = event_loop - - def pytest_collection_modifyitems(session, config, items): """Automatically apply the "asyncio" marker to any async test items.""" for item in items: is_async = inspect.iscoroutinefunction(getattr(item, "function", None)) has_marker = item.get_closest_marker("asyncio") if is_async and not has_marker: - item.add_marker("asyncio") + item.add_marker(pytest.mark.asyncio(scope="module")) @pytest.hookimpl(tryfirst=True, hookwrapper=True) diff --git a/pytest_operator/shims.py b/pytest_operator/shims.py old mode 100644 new mode 100755 diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 diff --git a/tests/data/bundle.yaml b/tests/data/bundle.yaml old mode 100644 new mode 100755 diff --git a/tests/data/charms/operator-framework/.flake8 b/tests/data/charms/operator-framework/.flake8 old mode 100644 new mode 100755 diff --git a/tests/data/charms/operator-framework/.jujuignore b/tests/data/charms/operator-framework/.jujuignore old mode 100644 new mode 100755 diff --git a/tests/data/charms/operator-framework/charmcraft.yaml b/tests/data/charms/operator-framework/charmcraft.yaml old mode 100644 new mode 100755 diff --git a/tests/data/charms/operator-framework/config.yaml b/tests/data/charms/operator-framework/config.yaml old mode 100644 new mode 100755 diff --git a/tests/data/charms/operator-framework/metadata.yaml b/tests/data/charms/operator-framework/metadata.yaml old mode 100644 new mode 100755 diff --git a/tests/data/charms/operator-framework/requirements.txt b/tests/data/charms/operator-framework/requirements.txt old mode 100644 new mode 100755 diff --git a/tests/data/charms/reactive-framework/config.yaml b/tests/data/charms/reactive-framework/config.yaml old mode 100644 new mode 100755 diff --git a/tests/data/charms/reactive-framework/layer.yaml b/tests/data/charms/reactive-framework/layer.yaml old mode 100644 new mode 100755 diff --git a/tests/data/charms/reactive-framework/metadata.yaml b/tests/data/charms/reactive-framework/metadata.yaml old mode 100644 new mode 100755 diff --git a/tests/data/charms/reactive-framework/reactive/reactive_framework.py b/tests/data/charms/reactive-framework/reactive/reactive_framework.py old mode 100644 new mode 100755 diff --git a/tests/data/charms/resourced-charm/metadata.yaml b/tests/data/charms/resourced-charm/metadata.yaml old mode 100644 new mode 100755 diff --git a/tests/data/etcd_ch_api_response.json b/tests/data/etcd_ch_api_response.json old mode 100644 new mode 100755 diff --git a/tests/data/model-config.yaml b/tests/data/model-config.yaml old mode 100644 new mode 100755 diff --git a/tests/data/test_lib/setup.py b/tests/data/test_lib/setup.py old mode 100644 new mode 100755 diff --git a/tests/integration/test_pytest_operator.py b/tests/integration/test_pytest_operator.py old mode 100644 new mode 100755 diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py old mode 100644 new mode 100755 index c6481d5..38712a1 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -1 +1,9 @@ +import pytest + pytest_plugins = ["pytester"] + + +@pytest.fixture(autouse=True) +@pytest.mark.asyncio_event_loop +def foo(): + pass diff --git a/tests/unit/test_pytest_operator.py b/tests/unit/test_pytest_operator.py old mode 100644 new mode 100755 diff --git a/tox.ini b/tox.ini old mode 100644 new mode 100755 index ba0012f..af8a297 --- a/tox.ini +++ b/tox.ini @@ -41,7 +41,7 @@ commands = pytest \ [testenv:integration] passenv = HOME commands = - pytest --tb=native --show-capture=no --log-cli-level=INFO\ + pytest --tb=native --show-capture=no --log-cli-level=INFO \ -vs --ignore=tests/data --ignore=tests/unit \ --model-config tests/data/model-config.yaml {posargs:tests/integration} deps =