Skip to content

Commit

Permalink
Merge pull request #988 from p12tic/tests-discovery
Browse files Browse the repository at this point in the history
Discover tests instead of passing a list of files to unittest
  • Loading branch information
p12tic committed Jul 3, 2024
2 parents 0517b9e + 9a4af0c commit 1c74d6c
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ jobs:
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi
- name: Run integration tests
run: |
python -m unittest -v tests/integration/*.py
python -m unittest discover -v tests/integration
env:
TESTS_DEBUG: 1
- name: Run unit tests
run: |
coverage run --source podman_compose -m unittest tests/unit/*.py
coverage run --source podman_compose -m unittest discover tests/unit
- name: Report coverage
run: |
coverage combine
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 tests/unit/*.py
$ python -m unittest tests/integration/*.py
$ coverage run --source podman_compose -m unittest discover tests/unit
$ python3 -m unittest discover tests/integration
$ coverage combine
$ coverage report
$ coverage html
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```shell
python -m unittest pytests/*.py
python3 -m unittest discover tests/unit
```

# Contributing guide
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_podman_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import unittest
from pathlib import Path

from .test_utils import RunSubprocessMixin
from tests.integration.test_utils import RunSubprocessMixin


def base_path():
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_podman_compose_additional_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import subprocess
import unittest

from .test_podman_compose import podman_compose_path
from .test_podman_compose import test_path
from tests.integration.test_podman_compose import podman_compose_path
from tests.integration.test_podman_compose import test_path


def compose_yaml_path():
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_podman_compose_build_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import subprocess
import unittest

from .test_podman_compose import podman_compose_path
from .test_podman_compose import test_path
from tests.integration.test_podman_compose import podman_compose_path
from tests.integration.test_podman_compose import test_path


def compose_yaml_path():
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_podman_compose_build_ulimits.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import subprocess
import unittest

from .test_podman_compose import podman_compose_path
from .test_podman_compose import test_path
from tests.integration.test_podman_compose import podman_compose_path
from tests.integration.test_podman_compose import test_path


def compose_yaml_path():
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_podman_compose_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

from parameterized import parameterized

from .test_podman_compose import podman_compose_path
from .test_podman_compose import test_path
from .test_utils import RunSubprocessMixin
from tests.integration.test_podman_compose import podman_compose_path
from tests.integration.test_podman_compose import test_path
from tests.integration.test_utils import RunSubprocessMixin


def profile_compose_file():
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_podman_compose_in_pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import unittest

from .test_utils import RunSubprocessMixin
from tests.integration.test_utils import RunSubprocessMixin


def base_path():
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_podman_compose_include.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import unittest
from pathlib import Path

from .test_utils import RunSubprocessMixin
from tests.integration.test_utils import RunSubprocessMixin


class TestPodmanComposeInclude(unittest.TestCase, RunSubprocessMixin):
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_podman_compose_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import os
import unittest

from .test_podman_compose import podman_compose_path
from .test_podman_compose import test_path
from .test_utils import RunSubprocessMixin
from tests.integration.test_podman_compose import podman_compose_path
from tests.integration.test_podman_compose import test_path
from tests.integration.test_utils import RunSubprocessMixin


class TestPodmanComposeNetwork(RunSubprocessMixin, unittest.TestCase):
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_podman_compose_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import os
import unittest

from .test_podman_compose import podman_compose_path
from .test_podman_compose import test_path
from .test_utils import RunSubprocessMixin
from tests.integration.test_podman_compose import podman_compose_path
from tests.integration.test_podman_compose import test_path
from tests.integration.test_utils import RunSubprocessMixin


class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_podman_compose_up_down.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

from parameterized import parameterized

from .test_podman_compose import podman_compose_path
from .test_podman_compose import test_path
from .test_utils import RunSubprocessMixin
from tests.integration.test_podman_compose import podman_compose_path
from tests.integration.test_podman_compose import test_path
from tests.integration.test_utils import RunSubprocessMixin


def profile_compose_file():
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/test_container_to_args_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
from parameterized import parameterized

from podman_compose import container_to_args

from .test_container_to_args import create_compose_mock
from .test_container_to_args import get_minimal_container
from tests.unit.test_container_to_args import create_compose_mock
from tests.unit.test_container_to_args import get_minimal_container


def repo_root():
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_get_net_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from parameterized import parameterized

from podman_compose import get_net_args

from .test_container_to_args import create_compose_mock
from tests.unit.test_container_to_args import create_compose_mock

PROJECT_NAME = "test_project_name"
SERVICE_NAME = "service_name"
Expand Down

0 comments on commit 1c74d6c

Please sign in to comment.