From 78c73d5b0168e4176c76540f385a77a8d1adfd3c Mon Sep 17 00:00:00 2001 From: Brent O'Connor Date: Mon, 15 Feb 2016 12:11:11 -0600 Subject: [PATCH] Added a tox.ini and updated the travis config to work with tox --- .gitignore | 1 + .travis.yml | 33 ++++++++++++++---------- categories/tests/test_category_import.py | 6 ++++- tox.ini | 14 ++++++++++ 4 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index e1c8ad4..02bf72b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ MANIFEST dist/ .venv example/media/ +.tox/ diff --git a/.travis.yml b/.travis.yml index 7eadf8f..8310e44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,23 @@ language: python -python: - - "2.7" -env: - - DJANGO_VERSION=1.6.11 - - DJANGO_VERSION=1.7.7 - - DJANGO_VERSION=1.8 -install: - - pip install Django==$DJANGO_VERSION - - pip install -e . - - pip install South -script: - - ./example/manage.py test categories --settings='settings-testing' + branches: only: - - master \ No newline at end of file + - master + +env: + - TOXENV=py27-django18 + - TOXENV=py27-django19 + - TOXENV=py34-django18 + - TOXENV=py34-django19 + - TOXENV=py35-django18 + - TOXENV=py35-django19 + +install: + - pip install tox + +script: + - tox -e $TOXENV + +after_success: + - pip install codecov + - codecov -e TOXENV diff --git a/categories/tests/test_category_import.py b/categories/tests/test_category_import.py index fd83864..8384add 100644 --- a/categories/tests/test_category_import.py +++ b/categories/tests/test_category_import.py @@ -3,12 +3,16 @@ # test mixed import os -from django.test import TestCase +from django.conf import settings +from django.test import TestCase, override_settings from categories.models import Category from categories.management.commands.import_categories import Command from django.core.management.base import CommandError +from categories.registration import _process_registry, registry + +@override_settings(INSTALLED_APPS=(app for app in settings.INSTALLED_APPS if app != 'django.contrib.flatpages')) class CategoryImportTest(TestCase): def setUp(self): pass diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..32fb129 --- /dev/null +++ b/tox.ini @@ -0,0 +1,14 @@ +[tox] +envlist = + py27-django{18,19}, + py34-django{18,19}, + py35-django{18,19}, + +[testenv] +deps= + django19: Django==1.9.2 + django18: Django==1.8.9 + -r{toxinidir}/requirements.txt + +commands= + {toxinidir}/example/manage.py test --settings='settings-testing' categories