From f3c186310b9dd1dcb5db96254d6d43b05889bd78 Mon Sep 17 00:00:00 2001 From: James Laska Date: Thu, 2 Jun 2016 11:18:33 -0400 Subject: [PATCH 1/6] First pass at getting tox and travis working --- .travis.yml | 40 +++++++++++++++++++++++++++++ tox.ini | 72 +++++++++++++++++++++++++---------------------------- 2 files changed, 74 insertions(+), 38 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..0d9a3e48b4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,40 @@ +sudo: required +dist: trusty +language: python +python: + - '2.7' +env: + - TOXENV=api-lint + - TOXENV=api + - TOXENV=ui-lint + - TOXENV=ui +install: + - pip install tox +script: + - tox +after_success: + - TOXENV=coveralls tox +addons: + apt: + packages: + # - libssl-dev + # - libxmlsec1 + # - libxmlsec1-dev + # - libxmlsec1-openssl + # - libxslt1-dev + # - pkg-config + # - swig + # The following were used when manually testing on an ubuntu trusty container + - make + - git + - swig + - python-tz + - python-dev + - libpq-dev + - libxmlsec1-dev + - libsasl2-dev + - libldap2-dev + - libssl-dev + - libffi-dev + - libevent-dev + - python-all-dev diff --git a/tox.ini b/tox.ini index ac36195f62..cdbf5ea71f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,50 +1,46 @@ [tox] envlist = - py26-dj14, py27-dj14, py26-dj15, py27-dj15, py26-dj16, py27-dj16 + api-lint, + ui-lint, + api, + ui, + coveralls [testenv] -commands = python manage.py test main -deps = - ansible==1.3.4 - python-ldap +basepython = python2.7 setenv = - DJANGO_SETTINGS_MODULE = awx.settings.development + DJANGO_SETTINGS_MODULE = awx.settings.development_quiet # For OS X to be able to install pycrypto. - CFLAGS=-I/opt/local/include -downloadcache = {toxworkdir}/cache - -[testenv:py26-dj14] -basepython = python2.6 + CFLAGS = -I/opt/local/include + HOME = {homedir} + USERPROFILE = {homedir} deps = - Django==1.4.10 - {[testenv]deps} + -r{toxinidir}/requirements/requirements.txt + -r{toxinidir}/requirements/requirements_dev.txt + coverage + coveralls + nodeenv -[testenv:py27-dj14] -basepython = python2.7 -deps = - Django==1.4.10 - {[testenv]deps} +[testenv:api-lint] +commands = + make flake8 + coverage erase -[testenv:py26-dj15] -basepython = python2.6 -deps = - Django==1.5.5 - {[testenv]deps} +[testenv:ui-lint] +commands = + make jshint -[testenv:py27-dj15] -basepython = python2.7 -deps = - Django==1.5.5 - {[testenv]deps} +[testenv:api] +commands = + coverage run --parallel -m pytest --create-db --source awx/main/tests {posargs} -[testenv:py26-dj16] -basepython = python2.6 -deps = - Django==1.6 - {[testenv]deps} +[testenv:ui] +commands = + make UI_TEST_MODE=CI test-ui + +[testenv:coveralls] +commands= + coverage combine + coverage report -m + coveralls -[testenv:py27-dj16] -basepython = python2.7 -deps = - Django==1.6 - {[testenv]deps} From 5c516b60b3689462dc205b58be65af2100a34de2 Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Tue, 7 Jun 2016 13:34:13 -0400 Subject: [PATCH 2/6] =?UTF-8?q?=C2=AF\=5F(=E3=83=84)=5F/=C2=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ --- .travis.yml | 23 +++-------------------- requirements/requirements.txt | 4 ++-- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0d9a3e48b4..61c97e8024 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ -sudo: required -dist: trusty +sudo: false language: python python: - '2.7' @@ -17,24 +16,8 @@ after_success: addons: apt: packages: - # - libssl-dev - # - libxmlsec1 - # - libxmlsec1-dev - # - libxmlsec1-openssl - # - libxslt1-dev - # - pkg-config - # - swig - # The following were used when manually testing on an ubuntu trusty container - - make - - git - swig - - python-tz - - python-dev - - libpq-dev - libxmlsec1-dev - - libsasl2-dev - - libldap2-dev + - postgresql-9.5 - libssl-dev - - libffi-dev - - libevent-dev - - python-all-dev + diff --git a/requirements/requirements.txt b/requirements/requirements.txt index a6bda0f61c..bdc9c6945d 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -28,8 +28,8 @@ django-taggit==0.17.6 git+https://github.com/matburt/dm.xmlsec.binding.git@master#egg=dm.xmlsec.binding dogpile.core==0.4.1 funcsigs==0.4 -gevent==1.1rc3 -gevent-websocket==0.9.3 +gevent==1.1 +gevent-websocket==0.9.5 git+https://github.com/chrismeyersfsu/django-jsonfield.git@tower_0.9.12#egg=django-jsonfield git+https://github.com/chrismeyersfsu/django-qsstats-magic.git@tower_0.7.2#egg=django-qsstats-magic git+https://github.com/umutbozkurt/django-rest-framework-mongoengine.git@5dfa1df79f81765d36c0de31dc1c2f390e42d428#egg=django-rest-framework-mongoengine From 6140c8c500018dfc82074c45d42bdc182185f1b6 Mon Sep 17 00:00:00 2001 From: James Laska Date: Wed, 8 Jun 2016 15:41:59 -0400 Subject: [PATCH 3/6] Additional travis/tox tweaks * Enable travis caching * Disable coverage after_build * Call setup.py develop first * Include pytest config and enable skipsdist --- .travis.yml | 10 +++++++--- pytest.ini | 2 +- tox.ini | 39 +++++++++++++++++++++++++++++++++------ 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 61c97e8024..f27f600962 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,8 @@ install: - pip install tox script: - tox -after_success: - - TOXENV=coveralls tox +# after_success: +# - TOXENV=coveralls tox addons: apt: packages: @@ -20,4 +20,8 @@ addons: - libxmlsec1-dev - postgresql-9.5 - libssl-dev - +cache: + pip: true + directories: + - node_modules + - .tox diff --git a/pytest.ini b/pytest.ini index 048e98312f..03c814599c 100644 --- a/pytest.ini +++ b/pytest.ini @@ -3,7 +3,7 @@ DJANGO_SETTINGS_MODULE = awx.settings.development python_paths = venv/tower/lib/python2.7/site-packages site_dirs = venv/tower/lib/python2.7/site-packages python_files = *.py -addopts = --reuse-db --nomigrations +addopts = --reuse-db --nomigrations --tb=native markers = ac: access control test license_feature: ensure license features are accessible or not depending on license diff --git a/tox.ini b/tox.ini index cdbf5ea71f..93c8b2f224 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,5 @@ [tox] +skipsdist = true envlist = api-lint, ui-lint, @@ -11,30 +12,46 @@ basepython = python2.7 setenv = DJANGO_SETTINGS_MODULE = awx.settings.development_quiet # For OS X to be able to install pycrypto. - CFLAGS = -I/opt/local/include + # CFLAGS = -I/opt/local/include + SWIG_FEATURES = -cpperraswarn -includeall -I/usr/include/openssl HOME = {homedir} USERPROFILE = {homedir} + ANSIBLE_USE_VENV = True + ANSIBLE_VENV_PATH = {toxworkdir} + TOWER_USE_VENV = True + TOWER_VENV_PATH = {toxworkdir} + SKIP_SLOW_TESTS = True + +[testenv:api-lint] deps = -r{toxinidir}/requirements/requirements.txt -r{toxinidir}/requirements/requirements_dev.txt coverage coveralls - nodeenv - -[testenv:api-lint] commands = make flake8 - coverage erase [testenv:ui-lint] +deps = + nodeenv commands = make jshint [testenv:api] +deps = + -r{toxinidir}/requirements/requirements.txt + -r{toxinidir}/requirements/requirements_dev.txt + coverage + coveralls commands = - coverage run --parallel -m pytest --create-db --source awx/main/tests {posargs} + python setup.py develop + # coverage run --help + # coverage run -p --source awx/main/tests -m pytest {posargs} + py.test awx/main/tests {posargs} [testenv:ui] +deps = + nodeenv commands = make UI_TEST_MODE=CI test-ui @@ -44,3 +61,13 @@ commands= coverage report -m coveralls +[pytest] +DJANGO_SETTINGS_MODULE = awx.settings.development +python_paths = venv/tower/lib/python2.7/site-packages +site_dirs = venv/tower/lib/python2.7/site-packages +python_files = *.py +addopts = --reuse-db --nomigrations --tb=native +markers = + ac: access control test + license_feature: ensure license features are accessible or not depending on license + mongo_db: drop mongodb test database before test runs From 29778538c3a8d3f1faedcef2535a1b6983d3be4c Mon Sep 17 00:00:00 2001 From: James Laska Date: Mon, 20 Jun 2016 10:48:58 -0400 Subject: [PATCH 4/6] Be sure to install ansible Enable the mongodb travis service too --- .travis.yml | 4 ++++ tox.ini | 1 + 2 files changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index f27f600962..8e00dc4371 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,3 +25,7 @@ cache: directories: - node_modules - .tox +services: + - mongodb + # Enable when we stop using sqlite for API tests + # - postgresql diff --git a/tox.ini b/tox.ini index 93c8b2f224..07239f7559 100644 --- a/tox.ini +++ b/tox.ini @@ -41,6 +41,7 @@ commands = deps = -r{toxinidir}/requirements/requirements.txt -r{toxinidir}/requirements/requirements_dev.txt + ansible coverage coveralls commands = From 77202ec6963b1fa9d04026cbe11b79a44aaf6b20 Mon Sep 17 00:00:00 2001 From: James Laska Date: Tue, 28 Jun 2016 14:56:04 -0400 Subject: [PATCH 5/6] Only run unit and function tests --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 07239f7559..871b872757 100644 --- a/tox.ini +++ b/tox.ini @@ -48,7 +48,7 @@ commands = python setup.py develop # coverage run --help # coverage run -p --source awx/main/tests -m pytest {posargs} - py.test awx/main/tests {posargs} + py.test awx/main/tests/{unit,functional} {posargs} [testenv:ui] deps = From 1f9df1fdf3747f8e2f75e874366f8192d92a709b Mon Sep 17 00:00:00 2001 From: James Laska Date: Tue, 28 Jun 2016 20:54:46 -0400 Subject: [PATCH 6/6] Default to not running old tests --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 871b872757..14726b2bd0 100644 --- a/tox.ini +++ b/tox.ini @@ -48,7 +48,7 @@ commands = python setup.py develop # coverage run --help # coverage run -p --source awx/main/tests -m pytest {posargs} - py.test awx/main/tests/{unit,functional} {posargs} + py.test awx/main/tests {posargs:-k 'not old'} [testenv:ui] deps =