Permalink
Browse files

tests independent from example projects

  • Loading branch information...
1 parent 8a012ba commit d4b066673ec294dcf3a9ff29f6cdc501c6277e59 @GeyseR GeyseR committed Mar 7, 2013
View
@@ -10,7 +10,7 @@ env:
- DJANGO=1.5
install:
- pip install Django==$DJANGO --use-mirrors
- - pip install -r test/example_thirdparty/requirements.txt -r test/example_thirdparty/requirements_test.txt
+ - pip install -r test/test_project/requirements_test.txt
script:
- - python test/example_thirdparty/manage.py test pybb
+ - python setup.py test
View
@@ -885,7 +885,7 @@ def setUp(self):
self.create_user()
self.create_initial()
- def test_attachment(self):
+ def test_attachment_one(self):
add_post_url = reverse('pybb:add_post', kwargs={'topic_id': self.topic.id})
self.login_client()
response = self.client.get(add_post_url)
@@ -896,7 +896,7 @@ def test_attachment(self):
self.assertEqual(response.status_code, 200)
self.assertTrue(Post.objects.filter(body='test attachment').exists())
- def test_attachment(self):
+ def test_attachment_two(self):
add_post_url = reverse('pybb:add_post', kwargs={'topic_id': self.topic.id})
self.login_client()
response = self.client.get(add_post_url)
View
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+import sys
+import os
+from os.path import dirname, abspath
+from optparse import OptionParser
+
+from django.conf import settings
+import django
+
+TEMPLATE_CONTEXT_PROCESSORS = (
+ 'django.contrib.auth.context_processors.auth',
+ 'django.core.context_processors.debug',
+ 'django.core.context_processors.i18n',
+ 'django.core.context_processors.media',
+ 'django.core.context_processors.static',
+ 'django.core.context_processors.request',
+ 'pybb.context_processors.processor',
+)
+
+if django.get_version() >= (1, 4):
+ TEMPLATE_CONTEXT_PROCESSORS += ['django.core.context_processors.tz',]
+
+# For convenience configure settings if they are not pre-configured or if we
+# haven't been provided settings to use by environment variable.
+if not settings.configured and not os.environ.get('DJANGO_SETTINGS_MODULE'):
+ settings.configure(
+ DATABASES={
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ }
+ },
+ INSTALLED_APPS=[
+ 'django.contrib.auth',
+ 'django.contrib.admin',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.sites',
+ 'pytils',
+ 'sorl.thumbnail',
+ 'pure_pagination',
+ 'pybb',
+ ],
+ ROOT_URLCONF='test.test_project.test_urls',
+ DEBUG=False,
+ SITE_ID=1,
+ STATIC_URL='/static/',
+ AUTH_PROFILE_MODULE='pybb.Profile',
+ TEMPLATE_DIRS=(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test/test_project/templates'), ),
+ PYBB_ATTACHMENT_ENABLE=True,
+ TEMPLATE_CONTEXT_PROCESSORS=TEMPLATE_CONTEXT_PROCESSORS,
+ )
+
+from django.test.simple import DjangoTestSuiteRunner
+
+
+def runtests(*test_args, **kwargs):
+ if 'south' in settings.INSTALLED_APPS:
+ from south.management.commands import patch_for_test_db_setup
+ patch_for_test_db_setup()
+
+ if not test_args:
+ test_args = ['pybb']
+ parent = dirname(abspath(__file__))
+ sys.path.insert(0, parent)
+ test_runner = DjangoTestSuiteRunner(verbosity=kwargs.get('verbosity', 1), interactive=kwargs.get('interactive', False), failfast=kwargs.get('failfast'))
+ failures = test_runner.run_tests(test_args)
+ sys.exit(failures)
+
+if __name__ == '__main__':
+ parser = OptionParser()
+ parser.add_option('--failfast', action='store_true', default=False, dest='failfast')
+
+ (options, args) = parser.parse_args()
+
+ runtests(failfast=options.failfast, *args)
View
@@ -1,29 +1,29 @@
from setuptools import setup, find_packages
setup(
- version = '0.12.4',
- description = 'PyBB Modified. Django forum application',
- long_description = open('README.rst').read(),
- author = 'Pavel Zhukov',
- author_email = 'gelios@gmail.com',
- name = 'pybbm',
- url = 'http://www.pybbm.org/',
- packages = find_packages(),
- include_package_data = True,
- package_data = {'': ['pybb/templates', 'pybb/static']},
- install_requires = [
- 'markdown',
- 'postmarkup',
- 'south',
- 'pytils',
- 'django-annoying',
- 'sorl-thumbnail',
- 'django-pure-pagination',
- 'django-mailer',
- ],
-
- license = "BSD",
- keywords = "django application forum board",
+ version='0.12.4',
+ description='PyBB Modified. Django forum application',
+ long_description=open('README.rst').read(),
+ author='Pavel Zhukov',
+ author_email='gelios@gmail.com',
+ name='pybbm',
+ url='http://www.pybbm.org/',
+ packages=find_packages(),
+ include_package_data=True,
+ package_data={'': ['pybb/templates', 'pybb/static']},
+ install_requires=[
+ 'markdown',
+ 'postmarkup',
+ 'south',
+ 'pytils',
+ 'django-annoying',
+ 'sorl-thumbnail',
+ 'django-pure-pagination',
+ 'django-mailer',
+ ],
+ test_suite='runtests.runtests',
+ license="BSD",
+ keywords="django application forum board",
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
No changes.
@@ -0,0 +1,17 @@
+{% load url from future %}
+{% load pytils_numeral %}
+<!DOCTYPE html>
+<html>
+<head>
+ {% block extra_style %}{% endblock %}
+ <title>{% block title %}{% endblock %}</title>
+ {% block extra_head %}{% endblock %}
+ {% block extra_script %}{% endblock %}
+</head>
+<body>
+{% block breadcrumb %}
+{% endblock breadcrumb %}
+{% block content %}
+{% endblock content %}
+</body>
+</html>
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+from django.conf.urls import patterns, include, url
+from django.contrib import admin
+
+admin.autodiscover()
+
+urlpatterns = patterns('',
+ url(r'^admin/', include(admin.site.urls)),
+
+ # TODO: we have to break such dependencies in application
+ url(r"^accounts/password/$", 'django.contrib.auth.views.password_change', name="auth_password_change"),
+ url(r"^accounts/signup/$", 'django.contrib.auth.views.login', name="registration_register", kwargs={'template_name': 'base.html'}),
+ url(r"^accounts/login/$", 'django.contrib.auth.views.login', name="auth_login", kwargs={'template_name': 'base.html'}),
+
+ url(r'^', include('pybb.urls', namespace='pybb')),
+)

0 comments on commit d4b0666

Please sign in to comment.