mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-20 07:43:35 -05:00
Automatically hack sys.path to make running tests easier
This commit is contained in:
@@ -53,26 +53,11 @@ The following notes are changes that may require changes to playbooks:
|
||||
|
||||
## Running Unit Tests
|
||||
|
||||
Tests to verify compatibility with the most recent AWX code are
|
||||
in `awx_collection/test/awx`. These tests require that Python packages
|
||||
are available for all of `awx`, `ansible`, `tower_cli`, and the collection
|
||||
itself.
|
||||
Tests to verify compatibility with the most recent AWX code are in `awx_collection/test/awx`.
|
||||
These can be ran by `make test_collection` in the development container.
|
||||
|
||||
### Inside Development Container
|
||||
|
||||
The target `make prepare_collection_venv` will prepare some requirements
|
||||
in the `awx_collection_test_venv` folder so that `make test_collection` can
|
||||
be executed to actually run the tests. A single test can be run via:
|
||||
|
||||
```
|
||||
make test_collection COLLECTION_TEST_DIRS=awx_collection/test/awx/test_organization.py
|
||||
```
|
||||
|
||||
### Manually
|
||||
|
||||
As a faster alternative (if you do not want to use the container), or to
|
||||
run against Ansible or `tower-cli` source, it is possible to set up a
|
||||
working environment yourself:
|
||||
To run outside of the development container, or to run against
|
||||
Ansible or `tower-cli` source, set up a working environment:
|
||||
|
||||
```
|
||||
mkvirtualenv my_new_venv
|
||||
@@ -80,11 +65,12 @@ mkvirtualenv my_new_venv
|
||||
pip install -r requirements/requirements.txt -r requirements/requirements_dev.txt -r requirements/requirements_git.txt
|
||||
make clean-api
|
||||
pip install -e <path to your Ansible>
|
||||
pip install -e <path to your tower-cli>
|
||||
pip install -e .
|
||||
PYTHONPATH=awx_collection:$PYTHONPATH py.test awx_collection/test/awx/
|
||||
py.test awx_collection/test/awx/
|
||||
```
|
||||
|
||||
If you do not install tower-cli, it will skip tests for modules that require it.
|
||||
|
||||
## Running Integration Tests
|
||||
|
||||
The integration tests require a virtualenv with `ansible` >= 2.9 and `tower_cli`.
|
||||
|
||||
Reference in New Issue
Block a user