Skip to content

Commit

Permalink
use pytest for running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioteula committed Oct 8, 2024
1 parent 0f27d27 commit 63f6002
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Install dependencies
run: pip install -e .
run: pip install -e . && pip install pytest
- name: Run tests
run: python -m unittest
run: python -m pytest

test-py38:
runs-on: ubuntu-latest
Expand All @@ -51,9 +51,9 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Install dependencies
run: pip install -e .
run: pip install -e . && pip install pytest
- name: Run tests
run: python -m unittest
run: python -m pytest

test-py39:
runs-on: ubuntu-latest
Expand All @@ -63,9 +63,9 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Install dependencies
run: pip install -e .
run: pip install -e . && pip install pytest
- name: Run tests
run: python -m unittest
run: python -m pytest

test-py310:
runs-on: ubuntu-latest
Expand All @@ -75,9 +75,9 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Install dependencies
run: pip install -e .
run: pip install -e . && pip install pytest
- name: Run tests
run: python -m unittest
run: python -m pytest

test-py311:
runs-on: ubuntu-latest
Expand All @@ -87,9 +87,9 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Install dependencies
run: pip install -e .
run: pip install -e . && pip install pytest
- name: Run tests
run: python -m unittest
run: python -m pytest


test-py312:
Expand All @@ -100,9 +100,9 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Install dependencies
run: pip install coverage certifi six python_dateutil setuptools urllib3
run: pip install -e . && pip install pytest
- name: Run tests
run: coverage run -m unittest && coverage xml && coverage report
run: coverage run -m pytest && coverage xml && coverage report
- name: Save code coverage file
uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RUN pip install --no-cache-dir \
coverage \
mypy \
pre-commit \
pytest \
ruff

COPY setup.py setup.py
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ build:
@docker build --build-arg TAG="3.12" --build-arg UID="${UID}" --build-arg GID="${GID}" -t python-amazon-paapi .

test: build
@docker run --rm -u "${UID}:${GID}" -v "${PWD}:/code" python-amazon-paapi -c "python -m unittest"
@docker run -t --rm -u "${UID}:${GID}" -v "${PWD}:/code" python-amazon-paapi -c "python -m pytest"

test-all-python-tags:
@for tag in $$PYTHON_TAGS; do \
docker build --build-arg TAG="$$tag" --build-arg UID="${UID}" --build-arg GID="${GID}" -t python-amazon-paapi .; \
docker run --rm -u "${UID}:${GID}" -v "${PWD}:/code" python-amazon-paapi -c "python -m unittest"; \
docker run -t --rm -u "${UID}:${GID}" -v "${PWD}:/code" python-amazon-paapi -c "python -m unittest"; \
done

lint: build
@docker run --rm -u "${UID}:${GID}" -v "${PWD}:/code" python-amazon-paapi -c "python -m pre_commit run -a"
@docker run --rm -t -u "${UID}:${GID}" -v "${PWD}:/code" python-amazon-paapi -c "python -m pre_commit run -a"

pre-commit:
@./.githooks/pre-commit

0 comments on commit 63f6002

Please sign in to comment.