From 8a4cda7f58c8676fcbb68c6dd8a7db4b31dc331e Mon Sep 17 00:00:00 2001 From: Matthew Scragg Date: Mon, 6 Oct 2014 16:07:20 -0500 Subject: [PATCH] add some tests --- .travis.yml | 4 ++-- dev-requirements.txt | 3 +++ install.sh | 6 +++--- manage.py | 2 +- realms/__init__.py | 6 ++++-- realms/templates/wiki/page.html | 5 ++--- 6 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 dev-requirements.txt diff --git a/.travis.yml b/.travis.yml index 69e819f..03f74ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,6 @@ python: before_install: - sudo apt-get install -y libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libyaml-dev libssl-dev -install: - - "python setup.py install" +install: "pip install -r dev-requirements" +script: nosetests diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 0000000..d129051 --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,3 @@ +-r requirements.txt +Flask-Testing==0.4.2 +nose==1.3.4 diff --git a/install.sh b/install.sh index df8a398..5b438bd 100755 --- a/install.sh +++ b/install.sh @@ -21,9 +21,9 @@ sudo apt-get update sudo apt-get install -y software-properties-common python-software-properties sudo add-apt-repository -y ppa:chris-lea/node.js sudo apt-get update -sudo apt-get install -y python build-essential git libpcre3-dev \ -python-pip python-virtualenv python-dev pkg-config curl libxml2-dev libxslt1-dev zlib1g-dev \ -libffi-dev nodejs libyaml-dev libssl-dev +sudo apt-get install -y python build-essential pkg-config git \ +python-pip python-virtualenv python-dev libxml2-dev libxslt1-dev zlib1g-dev \ +libffi-dev libyaml-dev libssl-dev nodejs # Default cache is memoization diff --git a/manage.py b/manage.py index 32c9b8b..161f9ee 100755 --- a/manage.py +++ b/manage.py @@ -4,7 +4,6 @@ from realms.lib.util import random_string from subprocess import call import click import json -import sys @cli.command() @@ -85,6 +84,7 @@ def setup_redis(**kw): def get_pip(): """ Get virtualenv path for pip """ + import sys return sys.prefix + '/bin/pip' diff --git a/realms/__init__.py b/realms/__init__.py index a002903..4c63701 100644 --- a/realms/__init__.py +++ b/realms/__init__.py @@ -1,10 +1,12 @@ +import sys +if 'threading' in sys.modules: + del sys.modules['threading'] + # Monkey patch stdlib. import gevent.monkey gevent.monkey.patch_all(aggressive=False, subprocess=True) # Set default encoding to UTF-8 -import sys - reload(sys) # noinspection PyUnresolvedReferences sys.setdefaultencoding('utf-8') diff --git a/realms/templates/wiki/page.html b/realms/templates/wiki/page.html index d191cb5..ce97782 100644 --- a/realms/templates/wiki/page.html +++ b/realms/templates/wiki/page.html @@ -16,11 +16,10 @@ {% endif %} - +
{% endblock %} + {% block js %}