Skip to content

Commit

Permalink
Refactor tests to not use a Django project
Browse files Browse the repository at this point in the history
  • Loading branch information
jjkester committed May 15, 2015
1 parent 909b07f commit 1d51184
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ env:
install:
- "pip install -r requirements.txt"
- "pip install Django==$DJANGO_VERSION"
script: "python src/manage.py test testapp"
script: "python src/auditlog_tests/runtests.py"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
django-auditlog
===============

[![Build Status](https://travis-ci.org/jjkester/django-auditlog.svg?branch=master)](https://travis-ci.org/jjkester/django-auditlog)

**Please remember that this app is still in development and not yet suitable for production environments.**

```django-auditlog``` (Auditlog) is a reusable app for Django that makes logging object changes a breeze. Auditlog tries to use as much as Python and Django’s built in functionality to keep the list of dependencies as short as possible. Also, Auditlog aims to be fast and simple to use.
Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions src/auditlog_tests/runtests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python
import os
import sys

import django
from django.conf import settings
from django.test.utils import get_runner

if __name__ == "__main__":
os.environ['DJANGO_SETTINGS_MODULE'] = 'auditlog_tests.test_settings'
django.setup()
TestRunner = get_runner(settings)
test_runner = TestRunner()
failures = test_runner.run_tests(["auditlog_tests"])
sys.exit(bool(failures))
24 changes: 24 additions & 0 deletions src/auditlog_tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
Settings file for the Auditlog test suite.
"""

SECRET_KEY = 'test'

INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'auditlog',
'auditlog_tests',
]

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'auditlog.middleware.AuditlogMiddleware',
)

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'auditlog_test',
}
}
2 changes: 1 addition & 1 deletion src/testapp/tests.py → src/auditlog_tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.test import TestCase, RequestFactory
from auditlog.middleware import AuditlogMiddleware
from auditlog.models import LogEntry
from testapp.models import SimpleModel, AltPrimaryKeyModel, ProxyModel, \
from auditlog_tests.models import SimpleModel, AltPrimaryKeyModel, ProxyModel, \
SimpleIncludeModel, SimpleExcludeModel


Expand Down
10 changes: 0 additions & 10 deletions src/manage.py

This file was deleted.

68 changes: 0 additions & 68 deletions src/test_project/settings.py

This file was deleted.

17 changes: 0 additions & 17 deletions src/test_project/urls.py

This file was deleted.

32 changes: 0 additions & 32 deletions src/test_project/wsgi.py

This file was deleted.

Empty file removed src/testapp/__init__.py
Empty file.

0 comments on commit 1d51184

Please sign in to comment.