-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
martinrusev
committed
Aug 1, 2011
1 parent
cc0d961
commit e805ada
Showing
16 changed files
with
201 additions
and
36 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Empty file.
Binary file not shown.
Empty file.
Binary file not shown.
Empty file.
Binary file not shown.
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import time | ||
from watchdog.observers import Observer | ||
from watchdog.events import PatternMatchingEventHandler | ||
from django.core.management.base import BaseCommand | ||
from os import path | ||
from django.conf import settings | ||
|
||
|
||
class AutotestEventHandler(PatternMatchingEventHandler): | ||
def on_any_event(self, event): | ||
print event.src_path | ||
|
||
path_to_file, filename = path.split(event.src_path) | ||
|
||
print path.split(event.src_path) | ||
|
||
class Command(BaseCommand): | ||
option_list = BaseCommand.option_list + ( | ||
) | ||
help = '' | ||
args = '[appname ...]' | ||
|
||
requires_model_validation = False | ||
|
||
def handle(self, *args, **options): | ||
self.event_handler = AutotestEventHandler(patterns=['*.py'], ignore_directories=True) | ||
self.run(*args, **options) | ||
|
||
def run(self, *args, **options): | ||
app_path = settings.PROJECT_ROOT | ||
|
||
observer = Observer() | ||
observer.schedule(self.event_handler, app_path, recursive=True) | ||
observer.start() | ||
try: | ||
while True: | ||
time.sleep(1) | ||
except KeyboardInterrupt: | ||
observer.stop() | ||
observer.join() | ||
|
||
def inner_run(self, *args, **options): | ||
from django.test.utils import get_runner | ||
|
||
self.stdout.write("Validating models...\n\n") | ||
|
||
verbosity = int(options.get('verbosity', 1)) | ||
interactive = options.get('interactive', True) | ||
failfast = options.get('failfast', False) | ||
TestRunner = get_runner(settings) | ||
|
||
if hasattr(TestRunner, 'func_name'): | ||
import warnings | ||
warnings.warn( | ||
'Function-based test runners are deprecated. Test runners should be classes with a run_tests() method.', | ||
DeprecationWarning | ||
) | ||
failures = TestRunner(args, verbosity=verbosity, interactive=interactive) | ||
else: | ||
test_runner = TestRunner(verbosity=verbosity, interactive=interactive, failfast=failfast) | ||
failures = test_runner.run_tests(args) | ||
|
||
print failures |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env python | ||
from django.core.management import execute_manager | ||
import imp | ||
try: | ||
imp.find_module('settings') # Assumed to be in the same directory. | ||
except ImportError: | ||
import sys | ||
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__) | ||
sys.exit(1) | ||
|
||
import settings | ||
|
||
if __name__ == "__main__": | ||
execute_manager(settings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
from os.path import abspath, dirname | ||
|
||
DEBUG = True | ||
TEMPLATE_DEBUG = DEBUG | ||
|
||
ADMINS = ( | ||
# ('Your Name', 'your_email@example.com'), | ||
) | ||
|
||
MANAGERS = ADMINS | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. | ||
'NAME': 'autotest.db', # Or path to database file if using sqlite3. | ||
'USER': '', # Not used with sqlite3. | ||
'PASSWORD': '', # Not used with sqlite3. | ||
'HOST': '', # Set to empty string for localhost. Not used with sqlite3. | ||
'PORT': '', # Set to empty string for default. Not used with sqlite3. | ||
} | ||
} | ||
|
||
TIME_ZONE = 'America/Chicago' | ||
|
||
LANGUAGE_CODE = 'en-us' | ||
|
||
SITE_ID = 1 | ||
|
||
USE_I18N = True | ||
|
||
USE_L10N = True | ||
|
||
MEDIA_ROOT = '' | ||
|
||
MEDIA_URL = '' | ||
|
||
STATIC_ROOT = '' | ||
|
||
STATIC_URL = '/static/' | ||
|
||
ADMIN_MEDIA_PREFIX = '/static/admin/' | ||
|
||
# Additional locations of static files | ||
STATICFILES_DIRS = ( | ||
) | ||
|
||
STATICFILES_FINDERS = ( | ||
'django.contrib.staticfiles.finders.FileSystemFinder', | ||
'django.contrib.staticfiles.finders.AppDirectoriesFinder', | ||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder', | ||
) | ||
|
||
# Make this unique, and don't share it with anybody. | ||
SECRET_KEY = 'w&mj%j1+=deov$vd3#$=2@hry&niq+5r9-xf&%wcqpdkzaqane' | ||
|
||
# List of callables that know how to import templates from various sources. | ||
TEMPLATE_LOADERS = ( | ||
'django.template.loaders.filesystem.Loader', | ||
'django.template.loaders.app_directories.Loader', | ||
# 'django.template.loaders.eggs.Loader', | ||
) | ||
|
||
MIDDLEWARE_CLASSES = ( | ||
'django.middleware.common.CommonMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
) | ||
|
||
ROOT_URLCONF = 'exampleapp.urls' | ||
|
||
TEMPLATE_DIRS = ( | ||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". | ||
# Always use forward slashes, even on Windows. | ||
# Don't forget to use absolute paths, not relative paths. | ||
) | ||
|
||
PROJECT_ROOT = abspath(dirname(__file__)) | ||
|
||
INSTALLED_APPS = ( | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.sites', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
'autotest', | ||
) | ||
|
||
LOGGING = { | ||
'version': 1, | ||
'disable_existing_loggers': False, | ||
'handlers': { | ||
'mail_admins': { | ||
'level': 'ERROR', | ||
'class': 'django.utils.log.AdminEmailHandler' | ||
} | ||
}, | ||
'loggers': { | ||
'django.request': { | ||
'handlers': ['mail_admins'], | ||
'level': 'ERROR', | ||
'propagate': True, | ||
}, | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from django.conf.urls.defaults import patterns, include, url | ||
|
||
# Uncomment the next two lines to enable the admin: | ||
# from django.contrib import admin | ||
# admin.autodiscover() | ||
|
||
urlpatterns = patterns('', | ||
# Examples: | ||
# url(r'^$', 'exampleapp.views.home', name='home'), | ||
# url(r'^exampleapp/', include('exampleapp.foo.urls')), | ||
|
||
# Uncomment the admin/doc line below to enable admin documentation: | ||
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')), | ||
|
||
# Uncomment the next line to enable the admin: | ||
# url(r'^admin/', include(admin.site.urls)), | ||
) |
This file was deleted.
Oops, something went wrong.