Merge pull request #976 from p12tic/tests-move-around

Move all tests to single directory "tests"
This commit is contained in:
Povilas Kanapickas 2024-06-26 11:30:21 +03:00 committed by GitHub
commit 0bcf0799b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
134 changed files with 118 additions and 53 deletions

View File

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

View File

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

View File

@ -9,12 +9,12 @@ from .test_utils import RunSubprocessMixin
def base_path():
"""Returns the base path for the project"""
return Path(__file__).parent.parent
return Path(__file__).parent.parent.parent
def test_path():
"""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():
@ -29,14 +29,18 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
includes a build context
:return:
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
command_up = [
"coverage",
"run",
str(main_path.joinpath("podman_compose.py")),
"-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",
"-d",
]
@ -46,7 +50,11 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
"run",
str(main_path.joinpath("podman_compose.py")),
"-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",
"--format",
'{{.Image}}',
@ -60,7 +68,11 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
self.run_subprocess_assert_returncode([
str(main_path.joinpath("podman_compose.py")),
"-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",
])
@ -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
configurations.)
"""
main_path = Path(__file__).parent.parent
main_path = Path(__file__).parent.parent.parent
command_up = [
"python3",
str(main_path.joinpath("podman_compose.py")),
"-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",
"-d",
]

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