Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add tox #67

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/syntax-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6.15"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up python
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6.15"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up python
Expand All @@ -18,11 +18,11 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependences from pip
shell: bash
run: pip install ansible nose coveralls mock requests coverage
run: pip install ansible pytest coveralls mock requests coverage
- name: NIFCLOUD modules check
shell: bash
run: |
nosetests --no-byte-compile --with-coverage --cover-package=library/ --where=library/
coverage run --source=library -m pytest library/tests/
coverage xml
- name: Coveralls
uses: coverallsapp/github-action@v2
Expand Down
19 changes: 16 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
FROM python:2.7
RUN pip install ansible coverage nose mock requests
WORKDIR /work
FROM 31z4/tox

USER root

RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
python3.6 \
python3.7 \
python3.8 \
python3.9 \
python3.10; \
rm -rf /var/lib/apt/lists/*

USER tox
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@

IMAGE_NAME := "nifcloud/ansible-role-nifcloud"

build:
docker build -t ${IMAGE_NAME} .

test:
make build
docker run --workdir /work/library --rm -ti -v $(PWD):/work ${IMAGE_NAME} bash -c " \
nosetests --no-byte-compile --with-coverage && \
coverage report --include=./nifcloud*.py"
docker run -u $(shell id -u):$(shell id -g) --workdir /work/library --rm -ti -v $(PWD):/work ${IMAGE_NAME}
Empty file added library/tests/__init__.py
Empty file.
17 changes: 17 additions & 0 deletions library/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[tox]
env_list =
3.9
3.10
3.11
3.12
3.13

[testenv]
deps =
pytest
coverage
mock
requests
pytest-cov
ansible
commands = coverage run --source='.' -m pytest tests/
Loading