mirror of
https://github.com/containers/podman-compose.git
synced 2025-05-20 06:01:06 +02:00
Merge pull request #988 from p12tic/tests-discovery
Discover tests instead of passing a list of files to unittest
This commit is contained in:
commit
1c74d6cd11
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -28,12 +28,12 @@ jobs:
|
|||||||
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 integration tests
|
- name: Run integration tests
|
||||||
run: |
|
run: |
|
||||||
python -m unittest -v tests/integration/*.py
|
python -m unittest discover -v tests/integration
|
||||||
env:
|
env:
|
||||||
TESTS_DEBUG: 1
|
TESTS_DEBUG: 1
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: |
|
run: |
|
||||||
coverage run --source podman_compose -m unittest tests/unit/*.py
|
coverage run --source podman_compose -m unittest discover tests/unit
|
||||||
- name: Report coverage
|
- name: Report coverage
|
||||||
run: |
|
run: |
|
||||||
coverage combine
|
coverage combine
|
||||||
|
@ -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 tests/unit/*.py
|
$ coverage run --source podman_compose -m unittest discover tests/unit
|
||||||
$ python -m unittest tests/integration/*.py
|
$ python3 -m unittest discover tests/integration
|
||||||
$ coverage combine
|
$ coverage combine
|
||||||
$ coverage report
|
$ coverage report
|
||||||
$ coverage html
|
$ coverage html
|
||||||
|
@ -130,7 +130,7 @@ that are meant to test as many cases as we can to make sure we are compatible
|
|||||||
run a unittest with following command
|
run a unittest with following command
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
python -m unittest pytests/*.py
|
python3 -m unittest discover tests/unit
|
||||||
```
|
```
|
||||||
|
|
||||||
# Contributing guide
|
# Contributing guide
|
||||||
|
@ -4,7 +4,7 @@ import os
|
|||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from .test_utils import RunSubprocessMixin
|
from tests.integration.test_utils import RunSubprocessMixin
|
||||||
|
|
||||||
|
|
||||||
def base_path():
|
def base_path():
|
||||||
|
@ -7,8 +7,8 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from .test_podman_compose import podman_compose_path
|
from tests.integration.test_podman_compose import podman_compose_path
|
||||||
from .test_podman_compose import test_path
|
from tests.integration.test_podman_compose import test_path
|
||||||
|
|
||||||
|
|
||||||
def compose_yaml_path():
|
def compose_yaml_path():
|
||||||
|
@ -7,8 +7,8 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from .test_podman_compose import podman_compose_path
|
from tests.integration.test_podman_compose import podman_compose_path
|
||||||
from .test_podman_compose import test_path
|
from tests.integration.test_podman_compose import test_path
|
||||||
|
|
||||||
|
|
||||||
def compose_yaml_path():
|
def compose_yaml_path():
|
||||||
|
@ -7,8 +7,8 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from .test_podman_compose import podman_compose_path
|
from tests.integration.test_podman_compose import podman_compose_path
|
||||||
from .test_podman_compose import test_path
|
from tests.integration.test_podman_compose import test_path
|
||||||
|
|
||||||
|
|
||||||
def compose_yaml_path():
|
def compose_yaml_path():
|
||||||
|
@ -12,9 +12,9 @@ import unittest
|
|||||||
|
|
||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
|
|
||||||
from .test_podman_compose import podman_compose_path
|
from tests.integration.test_podman_compose import podman_compose_path
|
||||||
from .test_podman_compose import test_path
|
from tests.integration.test_podman_compose import test_path
|
||||||
from .test_utils import RunSubprocessMixin
|
from tests.integration.test_utils import RunSubprocessMixin
|
||||||
|
|
||||||
|
|
||||||
def profile_compose_file():
|
def profile_compose_file():
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from .test_utils import RunSubprocessMixin
|
from tests.integration.test_utils import RunSubprocessMixin
|
||||||
|
|
||||||
|
|
||||||
def base_path():
|
def base_path():
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from .test_utils import RunSubprocessMixin
|
from tests.integration.test_utils import RunSubprocessMixin
|
||||||
|
|
||||||
|
|
||||||
class TestPodmanComposeInclude(unittest.TestCase, RunSubprocessMixin):
|
class TestPodmanComposeInclude(unittest.TestCase, RunSubprocessMixin):
|
||||||
|
@ -10,9 +10,9 @@ Tests the podman networking parameters
|
|||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from .test_podman_compose import podman_compose_path
|
from tests.integration.test_podman_compose import podman_compose_path
|
||||||
from .test_podman_compose import test_path
|
from tests.integration.test_podman_compose import test_path
|
||||||
from .test_utils import RunSubprocessMixin
|
from tests.integration.test_utils import RunSubprocessMixin
|
||||||
|
|
||||||
|
|
||||||
class TestPodmanComposeNetwork(RunSubprocessMixin, unittest.TestCase):
|
class TestPodmanComposeNetwork(RunSubprocessMixin, unittest.TestCase):
|
||||||
|
@ -10,9 +10,9 @@ Tests the podman compose up and down commands used to create and remove services
|
|||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from .test_podman_compose import podman_compose_path
|
from tests.integration.test_podman_compose import podman_compose_path
|
||||||
from .test_podman_compose import test_path
|
from tests.integration.test_podman_compose import test_path
|
||||||
from .test_utils import RunSubprocessMixin
|
from tests.integration.test_utils import RunSubprocessMixin
|
||||||
|
|
||||||
|
|
||||||
class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
|
class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
|
||||||
|
@ -12,9 +12,9 @@ import unittest
|
|||||||
|
|
||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
|
|
||||||
from .test_podman_compose import podman_compose_path
|
from tests.integration.test_podman_compose import podman_compose_path
|
||||||
from .test_podman_compose import test_path
|
from tests.integration.test_podman_compose import test_path
|
||||||
from .test_utils import RunSubprocessMixin
|
from tests.integration.test_utils import RunSubprocessMixin
|
||||||
|
|
||||||
|
|
||||||
def profile_compose_file():
|
def profile_compose_file():
|
||||||
|
@ -6,9 +6,8 @@ import unittest
|
|||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
|
|
||||||
from podman_compose import container_to_args
|
from podman_compose import container_to_args
|
||||||
|
from tests.unit.test_container_to_args import create_compose_mock
|
||||||
from .test_container_to_args import create_compose_mock
|
from tests.unit.test_container_to_args import get_minimal_container
|
||||||
from .test_container_to_args import get_minimal_container
|
|
||||||
|
|
||||||
|
|
||||||
def repo_root():
|
def repo_root():
|
||||||
|
@ -3,8 +3,7 @@ import unittest
|
|||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
|
|
||||||
from podman_compose import get_net_args
|
from podman_compose import get_net_args
|
||||||
|
from tests.unit.test_container_to_args import create_compose_mock
|
||||||
from .test_container_to_args import create_compose_mock
|
|
||||||
|
|
||||||
PROJECT_NAME = "test_project_name"
|
PROJECT_NAME = "test_project_name"
|
||||||
SERVICE_NAME = "service_name"
|
SERVICE_NAME = "service_name"
|
||||||
|
Loading…
Reference in New Issue
Block a user