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
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@ import os
 | 
			
		|||
import unittest
 | 
			
		||||
from pathlib import Path
 | 
			
		||||
 | 
			
		||||
from .test_utils import RunSubprocessMixin
 | 
			
		||||
from tests.integration.test_utils import RunSubprocessMixin
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def base_path():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,8 +7,8 @@ import os
 | 
			
		|||
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():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,8 +7,8 @@ import os
 | 
			
		|||
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():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,8 +7,8 @@ import os
 | 
			
		|||
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():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,9 +12,9 @@ import unittest
 | 
			
		|||
 | 
			
		||||
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():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
import os
 | 
			
		||||
import unittest
 | 
			
		||||
 | 
			
		||||
from .test_utils import RunSubprocessMixin
 | 
			
		||||
from tests.integration.test_utils import RunSubprocessMixin
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def base_path():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,9 +10,9 @@ Tests the podman networking parameters
 | 
			
		|||
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):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,9 +10,9 @@ Tests the podman compose up and down commands used to create and remove services
 | 
			
		|||
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):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,9 +12,9 @@ import unittest
 | 
			
		|||
 | 
			
		||||
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():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,9 +6,8 @@ import unittest
 | 
			
		|||
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():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,7 @@ import unittest
 | 
			
		|||
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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue