chore: Add tox configuration

Add tox configuration that allows to build a venv for development and to
format source files. To make use of it add appropriate Makefile targets.

Drop unneeded requirements from requirements.txt and
test-requirements.txt and add needed requirements.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This commit is contained in:
Felix Matouschek
2024-04-11 14:50:51 +02:00
parent b392d8077d
commit e2d2da2670
7 changed files with 39 additions and 12 deletions

3
.gitignore vendored
View File

@@ -136,6 +136,9 @@ bin/
*.tar.gz
*.zip
# pytest-ansible
collections/
# Collection specific ignores
/changelogs/.plugin-cache.yaml
/tests/output/

View File

@@ -7,3 +7,12 @@ cluster-up:
.PHONY: cluster-down
cluster-down:
hack/e2e-setup.sh --cleanup
.PHONY: build-venv
build-venv:
tox run -e venv
ln -sf .tox/venv .venv
.PHONY: format
format:
tox run -e format

View File

@@ -35,6 +35,7 @@ build_ignore:
- Makefile
- OWNERS
- REVIEW_CHECKLIST.md
- tox.ini
- '*.tar.gz'
- '*.zip'
- docs/_gh_include

View File

@@ -1,9 +1,4 @@
kubernetes-validate
coverage==4.5.4
mock
pytest
pytest-xdist
pytest-mock
pytest-forked
virtualenv
pytest-ansible
pytest-xdist
tox-ansible

2
tests/requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
# No additional requirements at this moment
# Have a look at /requirements.txt and /test-requirements.txt

View File

@@ -1,5 +0,0 @@
jinja2
jsonpatch
kubernetes>=28.1.0
PyYAML>=3.11
pytest

22
tox.ini Normal file
View File

@@ -0,0 +1,22 @@
[tox]
env_list = venv
[testenv:venv]
download = True
deps =
-r requirements.txt
-r test-requirements.txt
-r tests/requirements.txt
allowlist_externals =
mkdir
ln
commands =
mkdir -p "{env_site_packages_dir}/ansible_collections/kubevirt"
ln -sf "{tox_root}" "{env_site_packages_dir}/ansible_collections/kubevirt/core"
ansible-galaxy collection install -r requirements.yml -p "{env_site_packages_dir}/ansible_collections" --force
[testenv:format]
deps =
black
commands = black .