{ "info": { "author": "Kevin L. Mitchell", "author_email": "kevin.mitchell@rackspace.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "Intended Audience :: Information Technology", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Testing" ], "description": "========================================\nDependency-based Threaded Test Framework\n========================================\n\nThe DTest framework is a testing framework, similar to the standard\n``unittest`` package provided by Python. The value-add for DTest,\nhowever, is that test execution is threaded, through use of the\n``eventlet`` package. The DTest package also provides the concept of\n\"dependencies\" between tests and test fixtures--thus the \"D\" in\n\"DTest\"--which ensure that tests don't run until the matching set up\ntest fixtures have completed, and that the tear down test fixtures\ndon't run until all the associated tests have completed. Dependencies\nmay also be used to ensure that tests requiring the availability of\ncertain functionality don't run if the tests of that specific\nfunctionality fail.\n\nWriting Tests\n=============\n\nThe simplest test programs are simple functions with names beginning\nwith \"test,\" located in Python source files whose names also begin\nwith \"test.\" It is not even necessary to import any portion of the\nDTest framework. If tests are collected in classes, however, or if\nuse of the more advanced features of DTest is desired, a simple ``from\ndtest import *`` is necessary. This makes available the ``DTestCase``\nclass--which should be extended by all classes containing tests--as\nwell as such decorators as ``@skip`` and ``@nottest``.\n\nTests may be performed using the standard Python ``assert`` statement;\nhowever, a number of utility routines are available in the\n``dtest.util`` module (also safe for ``import *``). Many of these\nutility routines have names similar to methods of\n``unittest.TestCase``--e.g., ``dtest.util.assert_dict_equal()`` is\nanalogous to ``unittest.TestCase.assertDictEqual()``.\n\nTest Fixtures\n=============\n\nThe DTest framework supports test fixtures--set up and tear down\nfunctions--at the class, module, and package level. Package-level\nfixtures consist of functions named ``setUp()`` and ``tearDown()``\ncontained within \"__init__.py\" files; similarly, module-level fixtures\nconsist of functions samed ``setUp()`` and ``tearDown()`` within\nmodules containing test functions and classes of test methods. At the\nclass level, classes may contain ``setUpClass()`` and\n``tearDownClass()`` class methods (or static methods), which may\nperform set up and tear down for each class. In all cases, the\n``setUp()`` functions and the ``setUpClass()`` method are executed\nbefore any of the tests within the same scope; similarly, after all\nthe tests at a given scope have executed, the corresponding\n``tearDownClass()`` method and ``tearDown()`` functions are executed.\n\nThe DTest framework also supports per-test ``setUp()`` and\n``tearDown()`` functions or methods, which are run before and after\neach associated test. For classes containing tests, each test\nautomatically has the setUp() and tearDown() methods of the class\nassociated with them; however, for all tests, these fixtures can be\nexplicitly set (or overridden from the class default). Consider the\nfollowing example::\n\n @istest\n def test_something():\n # Test something here\n pass\n\n @test_something.setUp\n def something_setup():\n # Get everything set up ready to go...\n pass\n\n @test_something.tearDown\n def something_teardown():\n # Clean up after ourselves\n pass\n\nIn this example, a DTest decorator (other than ``@nottest``) is\nnecessary preceding ``test_something()``; here we used ``@istest``,\nbut any other available DTest decorator could be used here. This\nmakes the ``@test_something.setUp`` and ``@test_something.tearDown``\ndecorators available. (For something analogous in the standard\nPython, check out the built-in ``@property`` decorator.)\n\nTest Resources\n==============\n\nMany test suites use test fixtures to set up temporary resources\nneeded for a particular test. For instance, it's not uncommon for a\nfixture to set up a utility object, such as a server client, which\ncould be reused by other tests. The DTest framework provides an\nalternative means of setting up such objects: test resources.\n\nA test resource is any single object that may be required by a given\ntest. To create one, set up a class extending the ``Resource`` class\nand implement the ``setUp()`` method on the class (and, optionally,\nthe ``tearDown()`` method). There are two additional class attributes\nthat can be set. The first is ``oneshot``: if set to True, the\nresource returned by ``setUp()`` will only be used once, then\ndiscarded. The second is ``dirtymeths``, which should contain a list\nof methods which, when called, will cause the object to become\n\"dirty\", causing it to be discarded after the test. (Setting or\ndeleting object attributes will also cause the object to be marked as\n\"dirty\".)\n\nTo mark that a test requires a particular resource, use the\n``@require()`` decorator; this decorator takes keyword arguments,\nwhere the keys will be taken as the names of arguments to the test,\nand the values must be instances of subclasses of ``Resource``. When\nthe test is run, DTest will create the actual resource objects and\npass them to the test as keyword arguments. As long as the object\ndoes not become dirty, it will be reused for subsequent tests, subject\nto threading constraints (resource objects may only be used by one\nthread at a time).\n\nResource Limitations\n--------------------\n\nResources are subject to one limitation: the object actually passed to\nthe test is a proxy object which delegates attribute accesses to the\nactual object allocated by the ``setUp()`` method. Because of\noptimizations within Python itself, it is not possible for this proxy\nobject to properly delegate special methods, such as ``__getitem__()``\nor ``__add__()``. Because of this, it is possible to retrieve the\ntrue resource object, using the ``getobject()`` function. Because\nthis removes the ability of the resources system to determine if the\nresource becomes dirty, the ``dirty()`` and ``clean()`` functions are\nalso provided. Finally, to prevent an access from marking the object\nas dirty, the ``cleanaccess()`` function can be used in conjunction\nwith the ``with`` statement like so::\n\n with cleanaccess(resource):\n resource.attribute = \"some value\"\n\nWithout the ``with`` statement, this attribute setting would cause the\nresource to be marked as dirty, but the ``with`` inhibits this. Note\nthat it is legal to nest calls to ``cleanaccess()``, if necessary.\n\nResource Options\n----------------\n\nResources may be specified with options, which should be\nstring-coercible constants. Any positional or keyword arguments\npassed to the ``Resource`` constructor will be saved and passed to the\n``setUp()`` method when a resource must be constructed. In addition,\nthe resource caching mechanism uses these options to ensure that a\ntest is only passed resources with matching options.\n\nOptional ``tearDown()``\n-----------------------\n\nIf some special cleanup is needed for a resource, implement the\n``tearDown()`` method on your ``Resource`` subclass. It should take\ntwo arguments: the object that was returned by ``setUp()``, and the\nstatus of the test. For most resources, unless a test renders them\ndirty, the status will be ``None``, and ``tearDown()`` will be called\nafter all tests have run to completion; however, for resources which\nhave ``oneshot`` set to True, the status should never be ``None``.\nOne possible use case for this is a test which uses temporary files,\nwhich should be cleaned up after the test passes; should the test\nfail, it may be useful to leave the temporary file around for\ndebugging purposes.\n\nRunning Tests\n=============\n\nRunning tests using the DTest framework is fairly straight-forward. A\nscript called ``run-dtests`` is available. By default, the current\ndirectory is scanned for all modules or packages whose names begin\nwith \"test\"; the search also recurses down through all packages. (A\n\"package\" is defined as a directory containing \"__init__.py\".) Once\nall tests are discovered, they are then executed, and the results of\nthe tests emitted to standard output.\n\nSeveral command-line options are available for controlling the\nbehavior of ``run-dtests``. For instance, the \"--no-skip\" option will\ncause ``run-dtests`` to run all tests, even those decorated with the\n``@skip`` decorator, and the \"-d\" option causes ``run-dtests`` to\nsearch a specific directory, rather than the current directory. For a\nfull list of options, use the \"-h\" or \"--help\" option.\n\nRunning ``run-dtests`` from the command line is not the only way to\nrun tests, however. The ``run-dtests`` script is a very simple script\nthat parses command-line options (using the ``OptionParser``\nconstructed by the ``dtest.optparser()`` function), converts those\noptions into a set of keyword arguments (using\n``dtest.opts_to_args()``), then passes those keyword arguments to the\n``dtest.main()`` function. Users can use these functions to build the\nsame functionality with user-specific extensions, such as providing an\nalternate DTestOutput instance to control how test results are\ndisplayed, or providing an alternate method for controlling which\ntests are skipped. See the documentation strings for these functions\nand classes for more information.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/klmitch/dtest", "keywords": null, "license": "LICENSE.txt", "maintainer": null, "maintainer_email": null, "name": "DTest", "package_url": "https://pypi.org/project/DTest/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/DTest/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/klmitch/dtest" }, "release_url": "https://pypi.org/project/DTest/0.5.0/", "requires_dist": null, "requires_python": null, "summary": "Dependency-based Threaded Test Framework", "version": "0.5.0" }, "last_serial": 784064, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "2231edd5169610dc9625b9ad1d549513", "sha256": "f8977c57bba4bb1e5b54475f81453c97f567c3466c12dafd50a7829a1acb2c44" }, "downloads": -1, "filename": "DTest-0.1.tar.gz", "has_sig": false, "md5_digest": "2231edd5169610dc9625b9ad1d549513", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45682, "upload_time": "2011-04-12T00:01:23", "url": "https://files.pythonhosted.org/packages/34/21/7fae8717d04f21f184c84fabaacdfd2bb430a947fe6d13c4352fb794b146/DTest-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "ab040f727705d90d86e18cf158f6995b", "sha256": "6da4d145cb549efa84d67328e0e203a617d543b3d75061d42a04ac99026ccb3d" }, "downloads": -1, "filename": "DTest-0.2.tar.gz", "has_sig": false, "md5_digest": "ab040f727705d90d86e18cf158f6995b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45720, "upload_time": "2011-04-12T20:21:41", "url": "https://files.pythonhosted.org/packages/9f/12/886d84bb932ca325ce0b6deff338d62ec2a12e78fc5e41cec40d2186cb00/DTest-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "f1de5dff439d31162d3cc7a5b939362e", "sha256": "88a8df5f7eeace998128de92b4d4cd3f7c94ed59e0068367000e647f752ea7da" }, "downloads": -1, "filename": "DTest-0.2.1.tar.gz", "has_sig": false, "md5_digest": "f1de5dff439d31162d3cc7a5b939362e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45768, "upload_time": "2011-04-13T22:57:11", "url": "https://files.pythonhosted.org/packages/83/1a/8adca63b0f08ffa5696d56a7d2df266dce2726aaf99b18e72814763592e7/DTest-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "b0420696a446be33874961aa41225c65", "sha256": "bd7440e4372a84a205c2c4eceba463b611c7421701733178a904c26888ddd8c7" }, "downloads": -1, "filename": "DTest-0.2.2.tar.gz", "has_sig": false, "md5_digest": "b0420696a446be33874961aa41225c65", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 46603, "upload_time": "2011-04-14T20:42:16", "url": "https://files.pythonhosted.org/packages/f0/23/7a08618f25700a138699b7962435d3eacd704f2719ee15d6871aaa32e7cc/DTest-0.2.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "d3a0459b91824287bfc1986a6431c5c6", "sha256": "fd4541fa4691a9ba93e2ef15d6bfec533658fea3b774232cce610a1aeaba1b99" }, "downloads": -1, "filename": "DTest-0.3.tar.gz", "has_sig": false, "md5_digest": "d3a0459b91824287bfc1986a6431c5c6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47865, "upload_time": "2011-04-19T20:31:20", "url": "https://files.pythonhosted.org/packages/b7/8d/0532a4b1036704727aafd51d65fd458d613a2e28d884153207a933e2a5c7/DTest-0.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "962f6d52bbe10f4f626c3847d544e0c2", "sha256": "46268e72c75c42c82201c1b8d7e1bc693c74353723592b68bc690d375b39c441" }, "downloads": -1, "filename": "DTest-0.3.1.tar.gz", "has_sig": false, "md5_digest": "962f6d52bbe10f4f626c3847d544e0c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 46486, "upload_time": "2011-04-23T00:10:03", "url": "https://files.pythonhosted.org/packages/08/b0/92f1f5b6af3db71636d1cf4feb5bffd8f07592d41fb38084796407109bfd/DTest-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "1645189bb5832e44b5bef84d614c8e53", "sha256": "adfe9dc7afb9e29489d5f6af11aa04ad2be5ff51796822010fc4608aed104bdc" }, "downloads": -1, "filename": "DTest-0.3.2.tar.gz", "has_sig": false, "md5_digest": "1645189bb5832e44b5bef84d614c8e53", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 46895, "upload_time": "2011-05-11T23:58:06", "url": "https://files.pythonhosted.org/packages/69/b8/ad5060ee70c1e136a7626e9ac5ccda935878e46f1cd7288368056f1e08de/DTest-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "2bfd93b790e1f614004819248556a276", "sha256": "50beef7ed0588cdf86988a8ca63a3e38243d609dff4a8bd9553abe30fb589ae0" }, "downloads": -1, "filename": "DTest-0.3.3.tar.gz", "has_sig": false, "md5_digest": "2bfd93b790e1f614004819248556a276", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47038, "upload_time": "2011-06-08T21:32:11", "url": "https://files.pythonhosted.org/packages/37/d9/a4190e2779704be2cbc7095a9a7b605f6800444a09bb24347a9962f4e615/DTest-0.3.3.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "2daa5c26f9b8f882526c336d2fe7c57a", "sha256": "cf2713cb8f47126dd57532e522cb72886af8e710080ca0c4a41fe747bd7b11f3" }, "downloads": -1, "filename": "DTest-0.4.0.tar.gz", "has_sig": false, "md5_digest": "2daa5c26f9b8f882526c336d2fe7c57a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 56345, "upload_time": "2011-06-29T20:20:48", "url": "https://files.pythonhosted.org/packages/df/e4/001057bf7dc8344e7e400d39257b33d2a16e80bd1b7a1eede14d62920e74/DTest-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "f9d3764122d5e6dbf05f97b29abbd814", "sha256": "c9d84c8baa3846b9b650dde111e24e06217f7a773b3cae64090af47e2d652c6c" }, "downloads": -1, "filename": "DTest-0.5.0.tar.gz", "has_sig": false, "md5_digest": "f9d3764122d5e6dbf05f97b29abbd814", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 65002, "upload_time": "2011-10-25T22:55:32", "url": "https://files.pythonhosted.org/packages/ef/bf/13368c71f8526fb4278e16c7fea487f6f4b2d7b1d00daa12962013a9a86a/DTest-0.5.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f9d3764122d5e6dbf05f97b29abbd814", "sha256": "c9d84c8baa3846b9b650dde111e24e06217f7a773b3cae64090af47e2d652c6c" }, "downloads": -1, "filename": "DTest-0.5.0.tar.gz", "has_sig": false, "md5_digest": "f9d3764122d5e6dbf05f97b29abbd814", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 65002, "upload_time": "2011-10-25T22:55:32", "url": "https://files.pythonhosted.org/packages/ef/bf/13368c71f8526fb4278e16c7fea487f6f4b2d7b1d00daa12962013a9a86a/DTest-0.5.0.tar.gz" } ] }