Skip to content
Browse files

merge

  • Loading branch information...
2 parents 335318a + 41173c2 commit c5d59b11f7ba5cf6bd3adb7536407c6735abdafc @thraxil thraxil committed
View
6 CHANGES.txt
@@ -1,9 +1,11 @@
-0.18.3 (2012-09-19)
-===================
+0.17.4 (2012-09-19)
* production config fixes (python 2.6, paths, port in virtualhost,
sentry, admin media paths)
* 500 error page now displays cute sad owl picture
+* flake8 cleanup
+* include coverage reporting (and configure by default)
+* include requests library
0.17.2 (2012-08-07)
===================
View
2 README.md
@@ -37,6 +37,7 @@ What it provides for us that startproject doesn't:
* South is included for database migrations
* django-annoying is included (I like @render_to)
* django-nose installed and set up as test runner (much nicer!)
+* coverage reports configured for django-nose
* sqlite in-memory database used for unit tests
* south tests automatically skipped on ./manage.py test (they break)
* django_compressor added and set up to compress css on production
@@ -49,6 +50,7 @@ What it provides for us that startproject doesn't:
* django admin enabled (and authenticated with WIND for tlc)
* restclient
* httplib2
+* requests
* imageuploader
* markdown is included and enabled
* database defaulted to postgresql (cause MySQL is teh suck)
View
4 ccnmtldjango/__init__.py
@@ -1,9 +1,9 @@
from paste.script import templates
import pkg_resources
+
class CcnmtlDjangoTemplate(templates.Template):
egg_plugins = ["CcnmtlDjangoTemplate"]
- _template_dir = pkg_resources.resource_filename("ccnmtldjango","template")
+ _template_dir = pkg_resources.resource_filename("ccnmtldjango", "template")
summary = "CCNMTL Django template"
required_templates = []
-
View
1 ccnmtldjango/template/+package+/settings.py
@@ -1,3 +1,4 @@
+# flake8: noqa
from settings_shared import *
try:
View
1 ccnmtldjango/template/+package+/settings_production.py_tmpl
@@ -1,3 +1,4 @@
+# flake8: noqa
from settings_shared import *
TEMPLATE_DIRS = (
View
45 ccnmtldjango/template/+package+/settings_shared.py_tmpl
@@ -20,6 +20,27 @@ DATABASES = {
}
}
+if 'test' in sys.argv:
+ DATABASES = {
+ 'default' : {
+ 'ENGINE' : 'django.db.backends.sqlite3',
+ 'NAME' : ':memory:',
+ 'HOST' : '',
+ 'PORT' : '',
+ 'USER' : '',
+ 'PASSWORD' : '',
+ }
+ }
+
+TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
+SOUTH_TESTS_MIGRATE = False
+
+NOSE_ARGS = [
+ '--with-coverage',
+ '--cover-package=${package}',
+]
+
+
USE_TZ = True
TIME_ZONE = 'America/New_York'
LANGUAGE_CODE = 'en-us'
@@ -53,10 +74,6 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = '${package}.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.
- # Put application templates before these fallback ones:
"/var/www/${package}/templates/",
os.path.join(os.path.dirname(__file__),"templates"),
)
@@ -95,16 +112,6 @@ STATSD_HOST = '127.0.0.1'
STATSD_PORT = 8125
STATSD_PATCHES = ['django_statsd.patches.db', ]
-SENTRY_REMOTE_URL = 'http://sentry.ccnmtl.columbia.edu/sentry/store/'
-# remember to set the SENTRY_KEY in a local_settings.py
-# as documented in the wiki
-SENTRY_SITE = '${package}'
-
-TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
-if 'test' in sys.argv:
- DATABASE_ENGINE = 'sqlite3'
-SOUTH_TESTS_MIGRATE = False
-
THUMBNAIL_SUBDIR = "thumbs"
EMAIL_SUBJECT_PREFIX = "[${package}] "
EMAIL_HOST = 'localhost'
@@ -121,13 +128,17 @@ COMPRESS_ROOT = "media/"
# WIND settings
-AUTHENTICATION_BACKENDS = ('djangowind.auth.WindAuthBackend','django.contrib.auth.backends.ModelBackend',)
+AUTHENTICATION_BACKENDS = ('djangowind.auth.WindAuthBackend',
+ 'django.contrib.auth.backends.ModelBackend', )
WIND_BASE = "https://wind.columbia.edu/"
WIND_SERVICE = "cnmtl_full_np"
WIND_PROFILE_HANDLERS = ['djangowind.auth.CDAPProfileHandler']
-WIND_AFFIL_HANDLERS = ['djangowind.auth.AffilGroupMapper','djangowind.auth.StaffMapper','djangowind.auth.SuperuserMapper']
+WIND_AFFIL_HANDLERS = ['djangowind.auth.AffilGroupMapper',
+ 'djangowind.auth.StaffMapper',
+ 'djangowind.auth.SuperuserMapper']
WIND_STAFF_MAPPER_GROUPS = ['tlc.cunix.local:columbia.edu']
-WIND_SUPERUSER_MAPPER_GROUPS = ['anp8','jb2410','zm4','egr2107','sld2131','amm8','mar227','jed2161']
+WIND_SUPERUSER_MAPPER_GROUPS = ['anp8', 'jb2410', 'zm4', 'egr2107',
+ 'sld2131', 'amm8', 'mar227', 'jed2161']
SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
SESSION_COOKIE_HTTPONLY = True
View
25 ccnmtldjango/template/bootstrap.py
@@ -1,43 +1,46 @@
#!/usr/bin/env python
import glob
import os
-import sys
import subprocess
import shutil
pwd = os.path.abspath(os.path.dirname(__file__))
-vedir = os.path.abspath(os.path.join(pwd,"ve"))
+vedir = os.path.abspath(os.path.join(pwd, "ve"))
if os.path.exists(vedir):
shutil.rmtree(vedir)
-virtualenv_support_dir = os.path.abspath(os.path.join(pwd, "requirements", "virtualenv_support"))
+virtualenv_support_dir = os.path.abspath(
+ os.path.join(pwd, "requirements", "virtualenv_support"))
-ret = subprocess.call(["python", "virtualenv.py",
+ret = subprocess.call(["python", "virtualenv.py",
"--extra-search-dir=%s" % virtualenv_support_dir,
"--never-download",
vedir])
-if ret: exit(ret)
+if ret:
+ exit(ret)
ret = subprocess.call([os.path.join(vedir, 'bin', 'pip'), "install",
"-E", vedir,
"--index-url=''",
- "--requirement",os.path.join(pwd,"requirements/apps.txt")])
-if ret: exit(ret)
+ "--requirement",
+ os.path.join(pwd, "requirements/apps.txt")])
+if ret:
+ exit(ret)
+
def has_eggs():
return [os.path.basename(path) for path in
glob.glob(os.path.join(pwd, "requirements", "eggs", "*.egg"))]
-
if has_eggs():
# only try to easy install eggs if there actually are some
- cmd = ([os.path.join(vedir,"bin/easy_install"),
- '-f', os.path.join(pwd,"requirements/eggs/")] +
+ cmd = ([os.path.join(vedir, "bin/easy_install"),
+ '-f', os.path.join(pwd, "requirements/eggs/")] +
has_eggs())
ret = subprocess.call(cmd)
exit(ret)
-ret = subprocess.call(["python","virtualenv.py","--relocatable",vedir])
+ret = subprocess.call(["python", "virtualenv.py", "--relocatable", vedir])
# --relocatable always complains about activate.csh, which we don't really
# care about. but it means we need to ignore its error messages
View
5 ccnmtldjango/template/requirements/libs.txt
@@ -10,8 +10,7 @@ requirements/src/restclient-0.9.9.tar.gz
requirements/src/feedparser-4.1.tar.gz
requirements/src/imageuploader-0.1.tar.gz
requirements/src/Markdown-2.1.1.tar.gz
-# anders modified this to remove the stupid ez_setup requirement from setup.py
-requirements/src/pyenchant-1.5.1.tar.gz
+requirements/src/pyenchant-1.5.1.tar.gz
requirements/src/simplejson-2.0.9.tar.gz
requirements/src/smartypants-1.6.0.2.tar.gz
requirements/src/uuid-1.30.tar.gz
@@ -25,3 +24,5 @@ requirements/src/lxml-2.2.8.tar.gz
requirements/src/lettuce-0.1.34.tar.gz
requirements/src/rdflib-3.1.0.tar.gz
requirements/src/selenium-2.20.0.tar.gz
+requirements/src/coverage-3.5.3.tar.gz
+requirements/src/requests-0.13.3.tar.gz
View
BIN ccnmtldjango/template/requirements/src/coverage-3.5.3.tar.gz
Binary file not shown.
View
BIN ccnmtldjango/template/requirements/src/requests-0.13.3.tar.gz
Binary file not shown.
View
37 ccnmtldjango/template/terrain.py
@@ -2,19 +2,16 @@
from lettuce.django import django_url
from lettuce import before, after, world, step
from django.test import client
-import sys
import time
try:
from lxml import html
from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
- from selenium.common.exceptions import NoSuchElementException
- from selenium.webdriver.common.keys import Keys
- import selenium
except:
pass
+
@before.harvest
def setup_browser(variables):
ff_profile = FirefoxProfile()
@@ -23,26 +20,32 @@ def setup_browser(variables):
world.client = client.Client()
world.using_selenium = False
+
@after.harvest
def teardown_browser(total):
world.firefox.quit()
+
@before.each_scenario
def clear_data(_foo):
pass
+
@step(u'Using selenium')
def using_selenium(step):
world.using_selenium = True
+
@step(u'Finished using selenium')
def finished_selenium(step):
world.using_selenium = False
+
@before.each_scenario
def clear_selenium(step):
world.using_selenium = False
+
@step(r'I access the url "(.*)"')
def access_url(step, url):
if world.using_selenium:
@@ -51,6 +54,7 @@ def access_url(step, url):
response = world.client.get(django_url(url))
world.dom = html.fromstring(response.content)
+
@step(u'I am not logged in')
def i_am_not_logged_in(step):
if world.using_selenium:
@@ -58,10 +62,11 @@ def i_am_not_logged_in(step):
else:
world.client.logout()
+
@step(u'I am taken to a login screen')
def i_am_taken_to_a_login_screen(step):
assert len(world.response.redirect_chain) > 0
- (url,status) = world.response.redirect_chain[0]
+ (url, status) = world.response.redirect_chain[0]
assert status == 302, status
assert "/login/" in url, "URL redirected to was %s" % url
@@ -74,6 +79,7 @@ def there_is_not_a_link(step, text):
found = True
assert not found
+
@step(u'there is an? "([^"]*)" link')
def there_is_a_link(step, text):
found = False
@@ -82,6 +88,7 @@ def there_is_a_link(step, text):
found = True
assert found
+
@step(u'I click the "([^"]*)" link')
def i_click_the_link(step, text):
if not world.using_selenium:
@@ -108,40 +115,50 @@ def i_click_the_link(step, text):
world.firefox.get_screenshot_as_file("/tmp/selenium.png")
assert False, link.location
+
@step(u'I fill in "([^"]*)" in the "([^"]*)" form field')
def i_fill_in_the_form_field(step, value, field_name):
# note: relies on input having id set, not just name
if not world.using_selenium:
- assert False, "this step needs to be implemented for the django test client"
+ assert False, ("this step needs to be implemented for the "
+ "django test client")
world.firefox.find_element_by_id(field_name).send_keys(value)
+
@step(u'I submit the "([^"]*)" form')
def i_submit_the_form(step, id):
if not world.using_selenium:
- assert False, "this step needs to be implemented for the django test client"
+ assert False, ("this step needs to be implemented for the "
+ "django test client")
world.firefox.find_element_by_id(id).submit()
+
@step('I go back')
def i_go_back(self):
""" need to back out of games currently"""
if not world.using_selenium:
- assert False, "this step needs to be implemented for the django test client"
+ assert False, ("this step needs to be implemented for the "
+ "django test client")
world.firefox.back()
+
@step(u'I wait for (\d+) seconds')
-def wait(step,seconds):
+def wait(step, seconds):
time.sleep(int(seconds))
+
@step(r'I see the header "(.*)"')
def see_header(step, text):
if world.using_selenium:
- assert text.strip() == world.firefox.find_element_by_css_selector(".hero-unit>h1").text.strip()
+ assert text.strip() == world.firefox.find_element_by_css_selector(
+ ".hero-unit>h1").text.strip()
else:
header = world.dom.cssselect('.hero-unit>h1')[0]
assert text.strip() == header.text_content().strip()
+
@step(r'I see the page title "(.*)"')
def see_title(step, text):
if world.using_selenium:
View
3 setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
setup(name='ccnmtldjango',
- version="0.17.3",
+ version="0.17.4",
author="anders pearson",
description='Paste template for Django development at CCNMTL',
long_description=open('README.md').read(),
@@ -16,4 +16,3 @@
ccnmtldjango = ccnmtldjango:CcnmtlDjangoTemplate
"""
)
-

0 comments on commit c5d59b1

Please sign in to comment.
Something went wrong with that request. Please try again.