Просмотр исходного кода

Removed top-level tests directory. Test config now in celery.tests.config

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.
Ask Solem 14 лет назад
Родитель
Сommit
994faa8961
5 измененных файлов с 12 добавлено и 12 удалено
  1. 0 1
      MANIFEST.in
  2. 7 0
      celery/tests/__init__.py
  3. 0 0
      celery/tests/config.py
  4. 1 1
      pavement.py
  5. 4 10
      setup.py

+ 0 - 1
MANIFEST.in

@@ -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

+ 7 - 0
celery/tests/__init__.py

@@ -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"

+ 0 - 0
tests/celeryconfig.py → celery/tests/config.py


+ 1 - 1
pavement.py

@@ -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):

+ 4 - 10
setup.py

@@ -17,21 +17,15 @@ except ImportError:
 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:
@@ -75,7 +69,7 @@ setup(
     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",