Move all tests to single directory "tests"

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
Povilas Kanapickas 2024-06-26 11:01:48 +03:00
parent d38b26bb01
commit 18472b53ac
134 changed files with 118 additions and 53 deletions

View File

@ -26,14 +26,14 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi
- name: Run tests in tests/ - name: Run integration tests
run: | run: |
python -m unittest -v tests/*.py python -m unittest -v tests/integration/*.py
env: env:
TESTS_DEBUG: 1 TESTS_DEBUG: 1
- name: Run tests in pytests/ - name: Run unit tests
run: | run: |
coverage run --source podman_compose -m unittest pytests/*.py coverage run --source podman_compose -m unittest tests/unit/*.py
- name: Report coverage - name: Report coverage
run: | run: |
coverage combine coverage combine

View File

@ -54,8 +54,8 @@ Note: Some steps are OPTIONAL but all are RECOMMENDED.
7. Run code coverage: 7. Run code coverage:
```shell ```shell
$ coverage run --source podman_compose -m unittest pytests/*.py $ coverage run --source podman_compose -m unittest tests/unit/*.py
$ python -m unittest tests/*.py $ python -m unittest tests/integration/*.py
$ coverage combine $ coverage combine
$ coverage report $ coverage report
$ coverage html $ coverage html

View File

@ -9,12 +9,12 @@ from .test_utils import RunSubprocessMixin
def base_path(): def base_path():
"""Returns the base path for the project""" """Returns the base path for the project"""
return Path(__file__).parent.parent return Path(__file__).parent.parent.parent
def test_path(): def test_path():
"""Returns the path to the tests directory""" """Returns the path to the tests directory"""
return os.path.join(base_path(), "tests") return os.path.join(base_path(), "tests/integration")
def podman_compose_path(): def podman_compose_path():
@ -29,14 +29,18 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
includes a build context includes a build context
:return: :return:
""" """
main_path = Path(__file__).parent.parent main_path = Path(__file__).parent.parent.parent
command_up = [ command_up = [
"coverage", "coverage",
"run", "run",
str(main_path.joinpath("podman_compose.py")), str(main_path.joinpath("podman_compose.py")),
"-f", "-f",
str(main_path.joinpath("tests", "extends_w_file_subdir", "docker-compose.yml")), str(
main_path.joinpath(
"tests", "integration", "extends_w_file_subdir", "docker-compose.yml"
)
),
"up", "up",
"-d", "-d",
] ]
@ -46,7 +50,11 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
"run", "run",
str(main_path.joinpath("podman_compose.py")), str(main_path.joinpath("podman_compose.py")),
"-f", "-f",
str(main_path.joinpath("tests", "extends_w_file_subdir", "docker-compose.yml")), str(
main_path.joinpath(
"tests", "integration", "extends_w_file_subdir", "docker-compose.yml"
)
),
"ps", "ps",
"--format", "--format",
'{{.Image}}', '{{.Image}}',
@ -60,7 +68,11 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
self.run_subprocess_assert_returncode([ self.run_subprocess_assert_returncode([
str(main_path.joinpath("podman_compose.py")), str(main_path.joinpath("podman_compose.py")),
"-f", "-f",
str(main_path.joinpath("tests", "extends_w_file_subdir", "docker-compose.yml")), str(
main_path.joinpath(
"tests", "integration", "extends_w_file_subdir", "docker-compose.yml"
)
),
"down", "down",
]) ])
@ -81,13 +93,17 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
includes an empty service. (e.g. if the file is used as placeholder for more complex includes an empty service. (e.g. if the file is used as placeholder for more complex
configurations.) configurations.)
""" """
main_path = Path(__file__).parent.parent main_path = Path(__file__).parent.parent.parent
command_up = [ command_up = [
"python3", "python3",
str(main_path.joinpath("podman_compose.py")), str(main_path.joinpath("podman_compose.py")),
"-f", "-f",
str(main_path.joinpath("tests", "extends_w_empty_service", "docker-compose.yml")), str(
main_path.joinpath(
"tests", "integration", "extends_w_empty_service", "docker-compose.yml"
)
),
"up", "up",
"-d", "-d",
] ]

Some files were not shown because too many files have changed in this diff Show More