diff --git a/.github/workflows/pytest.yml b/.github/workflows/test.yml similarity index 90% rename from .github/workflows/pytest.yml rename to .github/workflows/test.yml index 76fc4b7..59c6a6c 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/test.yml @@ -1,12 +1,10 @@ --- -name: pytest +name: test on: pull_request: branches: - master - schedule: - - cron: "0 5 * * 5" jobs: molecule: @@ -36,7 +34,7 @@ jobs: - name: Install role requirements run: make requirements - - name: Run molecule tests. + - name: Run tests. run: make test env: PY_COLORS: "1" diff --git a/.gitignore b/.gitignore index c3cc8ac..5b60b7e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ tmp/ *.egg build htmlcov +*.tar.gz diff --git a/Makefile b/Makefile index 2950d47..54dc478 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ COLLECTION_VERSION = $$(yq '.version' < galaxy.yml) all: install version lint pytest verify pytest: install - poetry run pytest tests + poetry run pytest tests/pytest @echo test: pytest verify diff --git a/galaxy.yml b/galaxy.yml index c56ba06..facc87e 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -16,3 +16,5 @@ homepage: https://github.com/nephelaiio/ansible-collection-plugins issues: https://github.com/nephelaiio/ansible-collection-plugins/issues build_ignore: - Makefile + - .venv + - tests diff --git a/pyproject.toml b/pyproject.toml index 8fc8b3b..053ab63 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,3 +26,6 @@ build-backend = "poetry.core.masonry.api" venvPath = "." venv = ".venv" typeCheckingMode = "off" + +[tool.pytest.ini_options] +pythonpath = ["plugins/filter", "plugins/test"] diff --git a/tests/test_filter.py b/tests/pytest/test_filter.py similarity index 99% rename from tests/test_filter.py rename to tests/pytest/test_filter.py index 4c2cb06..3d7f2ea 100644 --- a/tests/test_filter.py +++ b/tests/pytest/test_filter.py @@ -1,12 +1,4 @@ -import os -import sys - import pytest - -sys.path.append(os.path.join(os.path.dirname(sys.path[0]), "plugins", "filter")) - -print(sys.path) - from custom_filter import ( # noqa: E402 alias_keys, dict_to_list, diff --git a/tests/test_test.py b/tests/pytest/test_test.py similarity index 73% rename from tests/test_test.py rename to tests/pytest/test_test.py index f26bf53..dff0c61 100644 --- a/tests/test_test.py +++ b/tests/pytest/test_test.py @@ -1,12 +1,4 @@ -import sys -import os -import pytest - -sys.path.append(os.path.join(os.path.dirname(sys.path[0]), "plugins", "test")) - -print(sys.path) - -from custom_test import (test_network, test_property) # noqa: E402 +from custom_test import test_network, test_property # noqa: E402 def test_test_network():