Skip to content

Commit

Permalink
attempted fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PietroPasotti committed Dec 4, 2023
1 parent d227968 commit 4cc708f
Show file tree
Hide file tree
Showing 29 changed files with 12 additions and 14 deletions.
Empty file modified .github/workflows/tests.yaml
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified CONTRIBUTING.md
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified docs/reference.md
100644 → 100755
Empty file.
Empty file modified pytest_operator/__init__.py
100644 → 100755
Empty file.
16 changes: 3 additions & 13 deletions pytest_operator/plugin.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)


Expand All @@ -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)
Expand Down
Empty file modified pytest_operator/shims.py
100644 → 100755
Empty file.
Empty file modified setup.py
100644 → 100755
Empty file.
Empty file modified tests/data/bundle.yaml
100644 → 100755
Empty file.
Empty file modified tests/data/charms/operator-framework/.flake8
100644 → 100755
Empty file.
Empty file modified tests/data/charms/operator-framework/.jujuignore
100644 → 100755
Empty file.
Empty file modified tests/data/charms/operator-framework/charmcraft.yaml
100644 → 100755
Empty file.
Empty file modified tests/data/charms/operator-framework/config.yaml
100644 → 100755
Empty file.
Empty file modified tests/data/charms/operator-framework/metadata.yaml
100644 → 100755
Empty file.
Empty file modified tests/data/charms/operator-framework/requirements.txt
100644 → 100755
Empty file.
Empty file modified tests/data/charms/reactive-framework/config.yaml
100644 → 100755
Empty file.
Empty file modified tests/data/charms/reactive-framework/layer.yaml
100644 → 100755
Empty file.
Empty file modified tests/data/charms/reactive-framework/metadata.yaml
100644 → 100755
Empty file.
Empty file.
Empty file modified tests/data/charms/resourced-charm/metadata.yaml
100644 → 100755
Empty file.
Empty file modified tests/data/etcd_ch_api_response.json
100644 → 100755
Empty file.
Empty file modified tests/data/model-config.yaml
100644 → 100755
Empty file.
Empty file modified tests/data/test_lib/setup.py
100644 → 100755
Empty file.
Empty file modified tests/integration/test_pytest_operator.py
100644 → 100755
Empty file.
8 changes: 8 additions & 0 deletions tests/unit/conftest.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
import pytest

pytest_plugins = ["pytester"]


@pytest.fixture(autouse=True)
@pytest.mark.asyncio_event_loop
def foo():
pass
Empty file modified tests/unit/test_pytest_operator.py
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion tox.ini
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 4cc708f

Please sign in to comment.