Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

Commit

Permalink
integrated AWX tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Mar 13, 2018
1 parent 9e57e0b commit 193382c
Show file tree
Hide file tree
Showing 9 changed files with 1,269 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,7 @@ setup_v1.py
tower_cli_v2/
bin/tower-cli-v2
setup_v2.py

# for AWX install
/awx
.cache/
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ python:
matrix:
allow_failures:
- python: nightly
before_install:
- ./install_awx.sh
install:
- pip install -r requirements_dev.txt
before_script:
flake8 .
script:
- flake8 tower-cli/ tests/
- tox
- py.test tests_awx/
after_success:
coveralls
9 changes: 9 additions & 0 deletions install_awx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rm -rf awx/
git clone https://github.com/ansible/awx.git awx --depth=1
cp tests_awx/CLI_settings.py awx/awx/settings/CLI_settings.py
python install_awx_req.py
cd awx
python setup.py install
cd ..
# have to add awx dir to path
[[ ":$PYTHONPATH:" != *":$PWD/awx:"* ]] && PYTHONPATH="${PYTHONPATH}:$PWD/awx"
34 changes: 34 additions & 0 deletions install_awx_req.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from subprocess import call

files = ['requirements.txt', 'requirements_dev.txt']


seen = set([])
failed = set([])


for file_name in files:
rel_path = 'awx/requirements/{}'.format(file_name)
with open(rel_path, 'r') as f:
data = f.read()
for line in data.split('\n'):
if not line or line.startswith('#') or not line.split('#'):
continue
target = line.split('#')[0].strip()
pkg = target.split('=')[0]
# same package listed in multiple files
if pkg in seen:
print('Skipping second listing of ' + str(pkg))
continue
# exclusions
if pkg in ['pip', 'setuptools']:
print('Passing over {}, in exclusions list'.format(target))
continue
seen.add(pkg)
r = call("pip install " + target, shell=True)
if r:
failed.add(target)

if failed:
print 'tower-cli AWX integration failed to install packages \n'
print ' - \n'.join(failed)
4 changes: 4 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pytest]
DJANGO_SETTINGS_MODULE = awx.settings.CLI_settings
python_files = *.py
addopts = --reuse-db --nomigrations --tb=native
3 changes: 2 additions & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
flake8
tox-travis
coveralls
coveralls
pytest
Loading

0 comments on commit 193382c

Please sign in to comment.