{ "info": { "author": "Kevin Seelbach", "author_email": "kevin.seelbach@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "*Fork of celerytest with minor bug fixes*\n\ncelerytest - Integration testing with Celery\n============================================\n\nWriting (integration) tests that depend on Celery tasks is problematic.\nWhen you manually run a Celery worker together with your tests, it runs\nin a separate process and there's no clean way to address objects\ntargeted by Celery from your tests. When you use a separate test\ndatabase (as with Django for example), you'll have to duplicate\nconfiguration code so your Celery worker accesses the same database.\n\ncelerytest provides the ability to run a Celery worker in the background\nfrom your tests. It also allows your tests to monitor the worker and\npause until Celery tasks are completed.\n\nUsing celerytest\n----------------\n\nTo start a Celery worker in a separate thread, use:\n\n.. code:: python\n\n app = Celery() # your Celery app\n worker = start_celery_worker(app) # configure the app for our celery worker\n\nTo wait for the worker to finish executing tasks, use:\n\n.. code:: python\n\n result = some_celery_task.delay()\n worker.idle.wait() # optionally specify time-out\n\nDjango\n~~~~~~\n\nTo use this with your django app through django-celery, get your app as\nsuch:\n\n.. code:: python\n\n from djcelery.app import app\n worker = start_celery_worker(app)\n\nTestCase\n~~~~~~~~\n\nIf you want to use this in a unittest TestCase, you can use\nCeleryTestCaseMixin. If you're writing unit tests that depend on a\ncelery worker, though, you're doing it wrong. For unit tests, you'll\nwant to mock your Celery methods and test them separately. You could use\nCeleryTestCaseMixin to write integration tests with Celery tasks,\nthough.\n\n.. code:: python\n\n from unittest import TestCase\n from celerytest.testcase import CeleryTestCaseMixin, setup_celery_worker\n import time\n\n app = Celery()\n setup_celery_worker(app) # need to setup worker outside\n\n class SomeTestCase(CeleryTestCaseMixin, TestCase):\n celery_app = app\n celery_concurrency = 4\n\n def test_something(self):\n result = multiply.delay(2,3)\n self.worker.idle.wait()\n self.assertEqual(result.get(), 6)\n\nLettuce\n~~~~~~~\n\nTo automatically launch a worker in the background while running a\nLettuce integration test suite, add to ``terrain.py``:\n\n.. code:: python\n\n # my_celery_app.py\n app = Celery('my_celery_app', broker='amqp://')\n\n # terrain.py\n from lettuce import *\n from celerytest import start_celery_worker\n\n # replace this with an import of your actual app\n from my_celery_app import app\n\n @before.harvest\n def initial_setup(server):\n # memory transport may not work here\n world.celery = start_celery_worker(app, config=\"amqp\")\n\n @after.harvest\n def cleanup(server):\n world.celery.stop()\n\n @after.each_step\n def after_step(step):\n # make sure we've received any scheduled tasks\n world.celery.active.wait(.05) \n # allow tasks to complete\n world.celery.idle.wait(5)\n\nInstallation\n------------\n\nInstall the latest version of ``celerytest`` from PyPI:\n\n::\n\n $ pip install celerytest\n\nOr, clone the latest version of ``celerytest`` from GitHub and run\nsetup:\n\n::\n\n $ git clone git://github.com/RentMethod/celerytest.git\n $ cd celerytest\n $ ./setup.py install # as root", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/kevinseelbach/celery_testutils", "keywords": "celery,testing,integration,test", "license": "BSD license, see LICENSE", "maintainer": "", "maintainer_email": "", "name": "celery-testutils", "package_url": "https://pypi.org/project/celery-testutils/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/celery-testutils/", "project_urls": { "Homepage": "http://github.com/kevinseelbach/celery_testutils" }, "release_url": "https://pypi.org/project/celery-testutils/0.1.2/", "requires_dist": [ "celery (>=3.0.19)" ], "requires_python": "", "summary": "Run a monitored Celery worker for integration tests that depend on Celery tasks", "version": "0.1.2" }, "last_serial": 2525942, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "c730ca00eed7688eb25263c2741f06f2", "sha256": "086319a7cc2982c1375f631ea20de39ba76b696fe42ee15acfd7240df1c03f91" }, "downloads": -1, "filename": "celery_testutils-0.1.1-py2-none-any.whl", "has_sig": false, "md5_digest": "c730ca00eed7688eb25263c2741f06f2", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 8492, "upload_time": "2016-12-18T03:58:04", "url": "https://files.pythonhosted.org/packages/f9/43/aa0cd4a0edcb1b713f2e0867db4180e5623893e8bb08a3250973dc727e88/celery_testutils-0.1.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0ec11a44676cf085592088887ecbd750", "sha256": "04378500e7d2d2e0baa7ed6a8e60bcc24acf5392ab673c93f9d4c5a499e8f69b" }, "downloads": -1, "filename": "celery_testutils-0.1.1.tar.gz", "has_sig": false, "md5_digest": "0ec11a44676cf085592088887ecbd750", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6460, "upload_time": "2016-12-18T03:58:06", "url": "https://files.pythonhosted.org/packages/78/26/e975ba18f35107e4a7b2be31ad66ac444af6fedfbfd9e9c8e24efcf943eb/celery_testutils-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "b26facbb651e3ba9b4e2c4afe97054b2", "sha256": "05f607f64346754a7a05941498105abfa5bcfb29f50a15c566f1cf07766d9d26" }, "downloads": -1, "filename": "celery_testutils-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "b26facbb651e3ba9b4e2c4afe97054b2", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 8768, "upload_time": "2016-12-18T04:31:54", "url": "https://files.pythonhosted.org/packages/d7/c1/b9d59b7f784d5c58d8510a2891d5af93e715c8404c8f6150aed0017db839/celery_testutils-0.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9d4226eb5086d34bfbaf1a6fc8fc6105", "sha256": "fa7fe7909398fc7f7b87a7745f5da9d943a31ab5cdd3d3d36c279ab9b43b2690" }, "downloads": -1, "filename": "celery_testutils-0.1.2.tar.gz", "has_sig": false, "md5_digest": "9d4226eb5086d34bfbaf1a6fc8fc6105", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6771, "upload_time": "2016-12-18T04:31:56", "url": "https://files.pythonhosted.org/packages/f6/11/67546e307a2f42afff0ee456b99a1f805e6456b1be989036a84291fd460f/celery_testutils-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b26facbb651e3ba9b4e2c4afe97054b2", "sha256": "05f607f64346754a7a05941498105abfa5bcfb29f50a15c566f1cf07766d9d26" }, "downloads": -1, "filename": "celery_testutils-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "b26facbb651e3ba9b4e2c4afe97054b2", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 8768, "upload_time": "2016-12-18T04:31:54", "url": "https://files.pythonhosted.org/packages/d7/c1/b9d59b7f784d5c58d8510a2891d5af93e715c8404c8f6150aed0017db839/celery_testutils-0.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9d4226eb5086d34bfbaf1a6fc8fc6105", "sha256": "fa7fe7909398fc7f7b87a7745f5da9d943a31ab5cdd3d3d36c279ab9b43b2690" }, "downloads": -1, "filename": "celery_testutils-0.1.2.tar.gz", "has_sig": false, "md5_digest": "9d4226eb5086d34bfbaf1a6fc8fc6105", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6771, "upload_time": "2016-12-18T04:31:56", "url": "https://files.pythonhosted.org/packages/f6/11/67546e307a2f42afff0ee456b99a1f805e6456b1be989036a84291fd460f/celery_testutils-0.1.2.tar.gz" } ] }