diff --git a/.gitignore b/.gitignore index ca2f573..d0576cf 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,8 @@ npm-debug.log* .tox nosetests.xml htmlcov +# Tests media +celery_growthmonitor/tests/media/ # Translations *.mo diff --git a/celery_growthmonitor/tests/settings.py b/celery_growthmonitor/tests/settings.py index a6b7bb8..706a6ca 100644 --- a/celery_growthmonitor/tests/settings.py +++ b/celery_growthmonitor/tests/settings.py @@ -1,25 +1,19 @@ from __future__ import absolute_import import os +from distutils.version import StrictVersion -BASE_DIR = os.path.dirname(os.path.realpath(__file__)) +import django -DEBUG = True +BASE_DIR = os.path.dirname(os.path.realpath(__file__)) -AUTHNET_LOGIN_ID = '' -AUTHNET_TRANSACTION_KEY = '' +DEBUG = False SECRET_KEY = 'm+qa*7_8t-=17zt_)9gi)4g%6w*v$xxkh6rwrys*bn9su+5%du' INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.admindocs', - 'django.contrib.auth', 'django.contrib.contenttypes', - 'django.contrib.messages', 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.staticfiles', 'celery_growthmonitor', @@ -32,6 +26,7 @@ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), }, } @@ -41,34 +36,13 @@ 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.common.CommonMiddleware', ] -MIDDLEWARE_CLASSES = MIDDLEWARE # Django < 1.10 - -LANGUAGE_CODE = 'en' - -# MEDIA CONFIGURATION -# ------------------------------------------------------------------------------ -# See: https://docs.djangoproject.com/en/stable/ref/settings/#media-root -MEDIA_ROOT = os.path.join(BASE_DIR, 'media') - -# See: https://docs.djangoproject.com/en/stable/ref/settings/#media-url -MEDIA_URL = '/media/' - -# STATIC FILE CONFIGURATION -# ------------------------------------------------------------------------------ -# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root -STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') -# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url -STATIC_URL = '/static/' +if StrictVersion(django.get_version()) < StrictVersion('1.10.0'): + MIDDLEWARE_CLASSES = MIDDLEWARE -# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders -STATICFILES_FINDERS = [ - 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -] - -LOGIN_URL = '/accounts/login/' +TIME_ZONE = 'Europe/Zurich' -MANAGERS = [] +LANGUAGE_CODE = 'en' SITE_ID = 1 @@ -76,39 +50,13 @@ USE_TZ = True -# TEMPLATE_DIRS = [os.path.join(os.path.dirname(__file__), 'templates')] -TEMPLATES = [ - { - # See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATES-BACKEND - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs - 'DIRS': [ - os.path.join(os.path.dirname(__file__), 'templates'), - ], - 'OPTIONS': { - # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug - 'debug': DEBUG, - # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders - # https://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types - 'loaders': [ - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', - ], - # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.template.context_processors.i18n', - 'django.template.context_processors.media', - 'django.template.context_processors.static', - 'django.template.context_processors.tz', - 'django.contrib.messages.context_processors.messages', - # Your stuff: custom template context processors go here - ], - }, - }, -] +# MEDIA CONFIGURATION +# ------------------------------------------------------------------------------ +# See: https://docs.djangoproject.com/en/stable/ref/settings/#media-root +MEDIA_ROOT = os.path.join(BASE_DIR, 'media') + +# See: https://docs.djangoproject.com/en/stable/ref/settings/#media-url +MEDIA_URL = '/media/' # CELERY # ------------------------------------------------------------------------------ @@ -117,3 +65,7 @@ CELERY_ACCEPT_CONTENT = ['pickle'] CELERY_TASK_SERIALIZER = 'pickle' CELERY_RESULT_SERIALIZER = 'pickle' + +# CELERY-GROWTHMONITOR +# ------------------------------------------------------------------------------ +CELERY_GROWTHMONITOR_APP_ROOT = os.path.join(MEDIA_ROOT, 'c_gm') diff --git a/celery_growthmonitor/tests/tests.py b/celery_growthmonitor/tests/tests.py index 54de96f..6058664 100644 --- a/celery_growthmonitor/tests/tests.py +++ b/celery_growthmonitor/tests/tests.py @@ -13,6 +13,13 @@ class Test(TestCase): + def tearDown(self): + from django.conf import settings + import os + import shutil + # Database is not kept but files would be otherwise + shutil.rmtree(os.path.join(settings.CELERY_GROWTHMONITOR_APP_ROOT, )) + def test_no_task(self): test_job = TestJob() test_job.save()