{ "info": { "author": "nsigustavo@gmail.com", "author_email": "Gustavo Rezende", "bugtrack_url": null, "classifiers": [], "description": "Welcome to ludibrio\r\n===================\r\n\r\n.. image:: http://ludibriar.appspot.com/_static/img/logo.png\r\n\r\n:Author: * Gustavo Rezende \r\n\r\n:Contributors: * Diego Pinheiro \r\n * Hugo Lopes \r\n * Rodrigo Manh\u00e3es \r\n * Rebeca Motta \r\n\r\n\r\nInstall\r\n-------\r\n\r\nLudibrio is registered with PyPi. If you have pip, setuptools or Distribute you can install mock with::\r\n\r\n $ sudo easy_install ludibrio\r\n\r\n\r\nDownload\r\n--------\r\n\r\nThe latest official version is 3.0.2. Here\u2019s how to get it::\r\n\r\n http://pypi.python.org/pypi/ludibrio/3.0.2\r\n\r\n\r\nDocumentation\r\n-------------\r\nSee the http://ludibriar.appspot.com/ for the current documentation.\r\n\r\n\r\n\r\nGetting involved !\r\n------------------\r\n\r\nLudibrio's development may be viewed and followed on github::\r\n\r\n http://github.com/nsigustavo/ludibrio\r\n\r\n\r\nRetrieve the source code using 'git'::\r\n\r\n $ git clone git://github.com/nsigustavo/ludibrio.git\r\n\r\n\r\nInstall package in 'development mode' and run tests with doctestcommand::\r\n\r\n $ sudo easy_install doctestcommand\r\n $ git clone git://github.com/nsigustavo/ludibrio.git\r\n $ cd ludibrio\r\n $ sudo python setup.py develop\r\n $ cd ludibrio\r\n $ doctest\r\n\r\n\r\n\r\n\r\n\r\n\r\nIn a nutshell\r\n=============\r\n\r\nTest doubles are fake objects that simulate the behavior of a real object for testing purposes.\r\n\r\n\r\nMock\r\n----\r\n\r\nMocks are objects pre-programmed with expectations which form a specification of the calls they are expected to receive::\r\n\r\n >>> from ludibrio import Mock\r\n >>> with Mock() as MySQLdb:\r\n ... con = MySQLdb.connect('server', 'user', 'XXXX')\r\n ... con.select_db('DB') >> None\r\n ... cursor = con.cursor()\r\n ... cursor.execute('select * from numbers') >> None\r\n ... cursor.fetchall() >> [1,2,3,4,5]\r\n\r\n::\r\n\r\n >>> con = MySQLdb.connect('server', 'user', 'XXXX')\r\n >>> con.select_db('DB')\r\n >>> cursor = con.cursor()\r\n >>> cursor.execute('select * from numbers')\r\n >>> cursor.fetchall()\r\n [1, 2, 3, 4, 5]\r\n\r\n >>> MySQLdb.validate() #passed\r\n\r\n\r\nStub\r\n----\r\n\r\nStubs provide pre-defined answers to method calls made during a test::\r\n\r\n >>> from ludibrio import Stub\r\n >>> with Stub() as x:\r\n ... x.anything() >> 'response'\r\n\r\n::\r\n\r\n >>> x.anything()\r\n 'response'\r\n\r\n\r\nTrivial mocking or stubing for any external module\r\n--------------------------------------------------\r\n\r\nLudibrio also offers a replace mode, which basically means if a \"from ... import ...\" statement is defined into a 'with' scope, the replay mechanism will return a mock object to replace the original object in namespace of the whole Python interpreter (including any modules, etc). There's a simple example below to illustrate how use it::\r\n\r\n >>> from ludibrio import Stub\r\n\r\n >>> with Stub() as time:\r\n ... from time import time\r\n ... time() >> 171\r\n\r\n::\r\n\r\n >>> from time import time\r\n >>> time()\r\n 171\r\n\r\n\r\n\r\nProxy\r\n-----\r\n\r\nTwo Ludibrio's powerful features that aren't found in other mocking systems is the ability of proxying existing objects, or patching a real instance or class.\r\n\r\nWhen an object is proxied, Ludibrio create a Test Double object holding a reference to the real object, allowing expressions passthrough to it(mocked or not, and by default or on request)::\r\n\r\n >>> from os.path import splitext\r\n >>> with Stub(proxy=splitext) as splitext:\r\n ... splitext('ludibrio/stubed.py') >> ('/temp/temp','.temp')\r\n\r\n::\r\n\r\n >>> splitext('mock.py')\r\n ('mock', '.py')\r\n >>> splitext('ludibrio/stubed.py')\r\n ('/temp/temp', '.temp')", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://nsigustavo.blogspot.com", "keywords": "mock stub fake dummy doubles mocks", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "ludibrio", "package_url": "https://pypi.org/project/ludibrio/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ludibrio/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://nsigustavo.blogspot.com" }, "release_url": "https://pypi.org/project/ludibrio/3.1.0/", "requires_dist": null, "requires_python": null, "summary": "Platform for test doubles in Python (mocks, stubs, and dummies)", "version": "3.1.0" }, "last_serial": 794395, "releases": { "2.0": [ { "comment_text": "built for Linux-2.6.31-21-generic-i686-with-glibc2.4", "digests": { "md5": "7d5cb9e95daa4088d1dc22c2f05a55af", "sha256": "9dc0d22a892c1899e32e8e4892206da119dc69186c5f309fe32dfd47883c54d5" }, "downloads": -1, "filename": "ludibrio-2.0.linux-i686.tar.gz", "has_sig": false, "md5_digest": "7d5cb9e95daa4088d1dc22c2f05a55af", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 14600, "upload_time": "2010-06-02T22:59:56", "url": "https://files.pythonhosted.org/packages/88/57/a56dd2b3d6174fecffceb378c2b1bc54277b026825175eee4fb434496eaa/ludibrio-2.0.linux-i686.tar.gz" }, { "comment_text": "", "digests": { "md5": "14a8eb4ecee839e2ce9f8234dad3afaf", "sha256": "9e4db7a8126455467768eb98030e619d11dede10f90e96a2e6bf9f61880d9f99" }, "downloads": -1, "filename": "ludibrio-2.0-py2.5.egg", "has_sig": false, "md5_digest": "14a8eb4ecee839e2ce9f8234dad3afaf", "packagetype": "bdist_egg", "python_version": "2.5", "requires_python": null, "size": 11520, "upload_time": "2009-10-21T20:15:27", "url": "https://files.pythonhosted.org/packages/d6/30/7a778740d510af94269a9ce353b7f40367d88f2e4f14bb6ae5aeb3297408/ludibrio-2.0-py2.5.egg" }, { "comment_text": "", "digests": { "md5": "ab38774451fc1cfb4b7e4874cb0187d5", "sha256": "044b9f356b8bbc14612095d7a0fc3c24c006b275cf64bd6574df6fedd195d8c2" }, "downloads": -1, "filename": "ludibrio-2.0.tar.gz", "has_sig": false, "md5_digest": "ab38774451fc1cfb4b7e4874cb0187d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5673, "upload_time": "2009-10-21T20:15:26", "url": "https://files.pythonhosted.org/packages/d7/ca/761d4f313bd932941e75c453b9795364a532b461043fc66e2a67778d8193/ludibrio-2.0.tar.gz" } ], "3.0": [ { "comment_text": "", "digests": { "md5": "48476c7d3802b0c7110d9a7ce0c22586", "sha256": "7714932488eb70bb107c35edb0102f8ec21ec8f1da10a42990e28d6a1c91f19c" }, "downloads": -1, "filename": "ludibrio-3.0.tar.gz", "has_sig": false, "md5_digest": "48476c7d3802b0c7110d9a7ce0c22586", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7675, "upload_time": "2010-06-02T23:02:54", "url": "https://files.pythonhosted.org/packages/df/0e/85a7373f1a5cbe1c322779115f1d9699911268730a3ccc2b65c4369827c9/ludibrio-3.0.tar.gz" } ], "3.0.1": [ { "comment_text": "", "digests": { "md5": "6153bfbf16e06ad4da1e353077605e1e", "sha256": "b5cc5b0064ac92493653d745d99abb6f0c306b07f6f13fb1a0e5962927a61f92" }, "downloads": -1, "filename": "ludibrio-3.0.1.tar.gz", "has_sig": false, "md5_digest": "6153bfbf16e06ad4da1e353077605e1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7699, "upload_time": "2010-06-02T23:10:04", "url": "https://files.pythonhosted.org/packages/90/e0/1e7b4f36b2fb6a83389903de2777a025e37a6036246764cfd25903fb1771/ludibrio-3.0.1.tar.gz" } ], "3.0.2": [ { "comment_text": "", "digests": { "md5": "80eb4efc9d0d391b7266630f37e45d9b", "sha256": "411fcadeed6312f53b52de6bf749b69f11c8455d9ae98704dda1831c1cc73e48" }, "downloads": -1, "filename": "ludibrio-3.0.2.tar.gz", "has_sig": false, "md5_digest": "80eb4efc9d0d391b7266630f37e45d9b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6998, "upload_time": "2010-06-19T07:28:26", "url": "https://files.pythonhosted.org/packages/94/f2/ed6efa9e1f46e52e4f7eee5515502be080a94db1b0ee7e16244d19e346d6/ludibrio-3.0.2.tar.gz" } ], "3.0.3": [ { "comment_text": "", "digests": { "md5": "faafe3911dfe51525f4b27d6b0de8351", "sha256": "a29a1373211bf5ddad1d3af580619d4dd5c604545e92709c44d6d25fd8e21fae" }, "downloads": -1, "filename": "ludibrio-3.0.3.tar.gz", "has_sig": false, "md5_digest": "faafe3911dfe51525f4b27d6b0de8351", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8034, "upload_time": "2010-09-19T00:53:55", "url": "https://files.pythonhosted.org/packages/b1/20/acba030957c73dbece4c70a73239720f235f472d630b2fd2ed5de779d7fa/ludibrio-3.0.3.tar.gz" } ], "3.1.0": [ { "comment_text": "", "digests": { "md5": "d83f752b7cad8baa9c6b6aa92605cab3", "sha256": "271a2a866b00a059d9330dc1213d182731121c83088a42f6b3e7f24777b522db" }, "downloads": -1, "filename": "ludibrio-3.1.0.tar.gz", "has_sig": false, "md5_digest": "d83f752b7cad8baa9c6b6aa92605cab3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5968, "upload_time": "2011-11-27T00:15:13", "url": "https://files.pythonhosted.org/packages/5c/b7/960bf226748b919729c084c2fd49f603523bfd070c9d997af5ac7d9327d6/ludibrio-3.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d83f752b7cad8baa9c6b6aa92605cab3", "sha256": "271a2a866b00a059d9330dc1213d182731121c83088a42f6b3e7f24777b522db" }, "downloads": -1, "filename": "ludibrio-3.1.0.tar.gz", "has_sig": false, "md5_digest": "d83f752b7cad8baa9c6b6aa92605cab3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5968, "upload_time": "2011-11-27T00:15:13", "url": "https://files.pythonhosted.org/packages/5c/b7/960bf226748b919729c084c2fd49f603523bfd070c9d997af5ac7d9327d6/ludibrio-3.1.0.tar.gz" } ] }