Permalink
Browse files

setup.py test anyone?

  • Loading branch information...
ojii committed Jun 8, 2012
1 parent 9211f45 commit fc1306c126471ef1c2a51b520b64f0535ae745fa
Showing with 33 additions and 27 deletions.
  1. +2 −1 .gitignore
  2. +1 −1 cms/plugins/inherit/models.py
  3. +0 −2 runshell.py
  4. +24 −22 runtests.py
  5. +6 −1 setup.py
View
@@ -21,7 +21,8 @@ dist
.project
.pydevproject
.settings
-*.egg-info
+/*.egg-info/
+/*.egg/
develop-eggs
downloads
eggs
@@ -1,7 +1,7 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin, Page
-from cms import settings
+from django.conf import settings
class InheritPagePlaceholder(CMSPlugin):
"""
View
@@ -1,8 +1,6 @@
#!/usr/bin/env python
from cms.test_utils.cli import configure
from cms.test_utils.tmpdir import temp_dir
-import os
-import sys
def main():
View
@@ -5,7 +5,23 @@
import sys
-def main():
+def main(test_runner='cms.test_utils.runners.NormalTestRunner', junit_output_dir='.',
+ time_tests=False, verbosity=1, failfast=False):
+ with temp_dir() as STATIC_ROOT:
+ with temp_dir() as MEDIA_ROOT:
+ configure(TEST_RUNNER=test_runner, JUNIT_OUTPUT_DIR=junit_output_dir,
+ TIME_TESTS=time_tests, ROOT_URLCONF='cms.test_utils.project.urls',
+ STATIC_ROOT=STATIC_ROOT, MEDIA_ROOT=MEDIA_ROOT)
+ from django.conf import settings
+ from django.test.utils import get_runner
+ TestRunner = get_runner(settings)
+
+ test_runner = TestRunner(verbosity=verbosity, interactive=False, failfast=failfast)
+ failures = test_runner.run_tests(['cms', 'menus'])
+ sys.exit(failures)
+
+
+if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--jenkins', action='store_true', default=False,
dest='jenkins')
@@ -19,25 +35,11 @@ def main():
dest='time_tests')
args = parser.parse_args()
if getattr(args, 'jenkins', False):
- TEST_RUNNER = 'cms.test_utils.runners.JenkinsTestRunner'
+ test_runner = 'cms.test_utils.runners.JenkinsTestRunner'
else:
- TEST_RUNNER = 'cms.test_utils.runners.NormalTestRunner'
- JUNIT_OUTPUT_DIR = getattr(args, 'jenkins_data_dir', '.')
- TIME_TESTS = getattr(args, 'time_tests', False)
- with temp_dir() as STATIC_ROOT:
- with temp_dir() as MEDIA_ROOT:
- configure(TEST_RUNNER=TEST_RUNNER, JUNIT_OUTPUT_DIR=JUNIT_OUTPUT_DIR,
- TIME_TESTS=TIME_TESTS, ROOT_URLCONF='cms.test_utils.project.urls',
- STATIC_ROOT=STATIC_ROOT, MEDIA_ROOT=MEDIA_ROOT)
- from django.conf import settings
- from django.test.utils import get_runner
- TestRunner = get_runner(settings)
-
- test_runner = TestRunner(verbosity=args.verbosity, interactive=False, failfast=args.failfast)
- failures = test_runner.run_tests(['cms', 'menus'])
- if failures:
- sys.exit(bool(failures))
-
-
-if __name__ == '__main__':
- main()
+ test_runner = 'cms.test_utils.runners.NormalTestRunner'
+ junit_output_dir = getattr(args, 'jenkins_data_dir', '.')
+ time_tests = getattr(args, 'time_tests', False)
+ main(test_runner=test_runner, junit_output_dir=junit_output_dir, time_tests=time_tests,
+ verbosity=args.verbosity, failfast=args.failfast)
+
View
@@ -35,7 +35,12 @@
'django-mptt==0.5.1',
'django-sekizai>=0.4.2',
],
+ tests_require=[
+ 'django-reversion==1.4',
+ 'Pillow==1.7.7',
+ ],
packages=find_packages(exclude=["project","project.*"]),
include_package_data=True,
- zip_safe = False
+ zip_safe = False,
+ test_suite = 'runtests.main',
)

0 comments on commit fc1306c

Please sign in to comment.