Skip to content

Commit

Permalink
Merge pull request #976 from p12tic/tests-move-around
Browse files Browse the repository at this point in the history
Move all tests to single directory "tests"
  • Loading branch information
p12tic authored Jun 26, 2024
2 parents d38b26b + 18472b5 commit 0bcf079
Show file tree
Hide file tree
Showing 134 changed files with 118 additions and 53 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

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():
Expand All @@ -29,14 +29,18 @@ def test_extends_w_file_subdir(self):
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",
]
Expand All @@ -46,7 +50,11 @@ def test_extends_w_file_subdir(self):
"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}}',
Expand All @@ -60,7 +68,11 @@ def test_extends_w_file_subdir(self):
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",
])

Expand All @@ -81,13 +93,17 @@ def test_extends_w_empty_service(self):
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",
]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 0bcf079

Please sign in to comment.