Skip to content

Commit

Permalink
Removed top-level tests directory. Test config now in celery.tests.co…
Browse files Browse the repository at this point in the history
…nfig

This means running the unittests doesn't require any special setup.
celery/tests/__init__ now configures the CELERY_CONFIG_MODULE and
CELERY_LOADER, so when nosetests imports that, the unit test environment
is all set up.
  • Loading branch information
Ask Solem committed Jun 11, 2010
1 parent 9c54c7a commit 994faa8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ include setup.cfg
recursive-include bin *
recursive-include celery *.py
recursive-include docs *
recursive-include tests *
recursive-include contrib *
recursive-include examples *
prune tests/*.pyc
Expand Down
7 changes: 7 additions & 0 deletions celery/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os

config = os.environ.setdefault("CELERY_TEST_CONFIG_MODULE",
"celery.tests.config")

os.environ["CELERY_CONFIG_MODULE"] = config
os.environ["CELERY_LOADER"] = "default"
File renamed without changes.
2 changes: 1 addition & 1 deletion pavement.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def bump(options):
("verbose", "V", "Make more noise"),
])
def test(options):
cmd = "CELERY_LOADER=default PYTHONPATH=tests nosetests"
cmd = "CELERY_LOADER=default nosetests"
if getattr(options, "coverage", False):
cmd += " --with-coverage3"
if getattr(options, "quick", False):
Expand Down
14 changes: 4 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,15 @@
import celery as distmeta


class RunTests(TestCommand):
env = dict(CELERY_LOADER="default",
CELERY_CONFIG_MODULE="tests.celeryconfig",
CELERYINIT=1)
extra_env = {}
class QuickRunTests(TestCommand):
extra_env = dict(SKIP_RLIMITS=1, QUICKTEST=1)

def run(self, *args, **kwargs):
for env_name, env_value in dict(self.env, **self.extra_env).items():
for env_name, env_value in self.extra_env.items():
os.environ[env_name] = str(env_value)
TestCommand.run(self, *args, **kwargs)


class QuickRunTests(RunTests):
extra_env = dict(SKIP_RLIMITS=1, QUICKTEST=1)

install_requires = []

try:
Expand Down Expand Up @@ -75,7 +69,7 @@ class QuickRunTests(RunTests):
zip_safe=False,
install_requires=install_requires,
tests_require=['nose-cover3', 'unittest2', 'simplejson'],
cmdclass = {"test": RunTests, "quicktest": QuickRunTests},
cmdclass = {"quicktest": QuickRunTests},
test_suite="nose.collector",
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down

0 comments on commit 994faa8

Please sign in to comment.