Skip to content

Commit

Permalink
chore: Add tox configuration
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
0xFelix committed Apr 12, 2024
1 parent b392d80 commit e2d2da2
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ bin/
*.tar.gz
*.zip

# pytest-ansible
collections/

# Collection specific ignores
/changelogs/.plugin-cache.yaml
/tests/output/
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ build_ignore:
- Makefile
- OWNERS
- REVIEW_CHECKLIST.md
- tox.ini
- '*.tar.gz'
- '*.zip'
- docs/_gh_include
Expand Down
9 changes: 2 additions & 7 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# No additional requirements at this moment
# Have a look at /requirements.txt and /test-requirements.txt
5 changes: 0 additions & 5 deletions tests/unit/requirements.txt

This file was deleted.

22 changes: 22 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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 .

0 comments on commit e2d2da2

Please sign in to comment.