forked from nailor/nosedjango
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
141 lines (115 loc) · 3.93 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import codecs
import os
import sys
from setuptools import setup, find_packages, Command
class RunTestBase(Command):
description = "Run the test suite from the tests dir."
user_options = []
extra_env = {}
def initialize_options(self):
pass
def finalize_options(self):
pass
class RunTests(RunTestBase):
test_app = 'nosedjangotests.polls'
check_selenium = False
label = ''
args = []
def verify_selenium(self):
if not self.check_selenium:
return
try:
import selenium # noqa
except ImportError:
print "Selenium not installed. Skipping tests."
sys.exit(0)
def run(self):
for env_name, env_value in self.extra_env.items():
os.environ[env_name] = str(env_value)
setup_dir = os.path.abspath(os.path.dirname(__file__))
tests_dir = os.path.join(setup_dir, 'nosedjangotests')
os.chdir(tests_dir)
sys.path.append(tests_dir)
try:
from nose.core import TestProgram
import nosedjango
print nosedjango.__version__
except ImportError:
print 'nose and nosedjango are required to run this test suite'
sys.exit(1)
print "Running tests with {label}".format(label=self.label)
self.verify_selenium()
test_args = [
'-v',
'--verbosity=2',
'--with-doctest',
'--with-django',
'--django-settings', 'nosedjangotests.settings',
self.test_app,
] + self.args
TestProgram(argv=test_args, exit=True)
class SQLiteTestCase(RunTests):
label = 'sqlite'
args = [
'--with-django-sqlite',
]
class MultiProcessTestCase(RunTests):
label = 'sqlite and multiprocess'
args = [
'--with-django-sqlite',
'--processes', '3',
]
class MySQLTestCase(RunTests):
label = 'MySQL'
class CherryPyLiveServerTestCase(RunTests):
label = 'Cherry Py Test Case'
args = [
'--with-django-sqlite',
'--with-cherrypyliveserver',
]
class SeleniumTestCase(RunTests):
label = 'Selenium'
test_app = 'nosedjangotests.selenium_tests'
check_selenium = True
args = [
'--with-selenium',
]
import nosedjango
long_description = codecs.open("README.rst", "r", "utf-8").read()
setup(
name='nosedjango',
version=nosedjango.__version__,
description=nosedjango.__doc__,
author=nosedjango.__author__,
author_email=nosedjango.__contact__,
long_description=long_description,
install_requires=['nose<2.0', 'django'],
extras_require={
'selenium': ['selenium>=2.0'],
},
dependency_links=['http://bitbucket.org/jpellerin/nose/get/release_0.11.4.zip#egg=nose-0.11.4.dev'], # noqa
url="http://github.com/nosedjango/nosedjango",
license='GNU LGPL',
packages=find_packages(exclude=['nosedjangotests', 'nosedjangotests.*']),
zip_safe=False,
cmdclass={
'test_sqlite': SQLiteTestCase,
'test_multiprocess': MultiProcessTestCase,
'test_mysql': MySQLTestCase,
'test_selenium': SeleniumTestCase,
'test_cherrypy': CherryPyLiveServerTestCase,
},
include_package_data=True,
entry_points={
'nose.plugins': [
'celery = nosedjango.plugins.celery_plugin:CeleryPlugin',
'cherrypyliveserver = nosedjango.plugins.cherrypy_plugin:CherryPyLiveServerPlugin', # noqa
'django = nosedjango.nosedjango:NoseDjango',
'djangofilestorage = nosedjango.plugins.file_storage_plugin:FileStoragePlugin', # noqa
'djangosphinxsearch = nosedjango.plugins.sphinxsearch_plugin:SphinxSearchPlugin', # noqa
'djangosqlite = nosedjango.plugins.sqlite_plugin:SqlitePlugin',
'selenium = nosedjango.plugins.selenium_plugin:SeleniumPlugin',
'sshtunnel = nosedjango.plugins.ssh_tunnel_plugin:SshTunnelPlugin',
],
},
)