{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Testing" ], "description": "When you write a C extension, you can provide a Python version as a backup. A\nproblem with this is that only one of these modules will be tested, while the\nother is neglected.\n\nDualTest provides a class that, when inherited from, imports a list of modules\nand attributes from modules and makes them available as globals during tests.\nAllowing you to easily test both versions of a module and write just one set of\ntests.\n\n=====\nUsage\n=====\n\nCreate a test case class derived from DualTestCase and set the `import_names`\nor `import_from_names` class attributes.\n\n`import_names` should be set to a list of the names of modules with Python\nsource and C extension versions to import:\n\n.. code:: python\n\n class ImportTestCase(DualTestCase):\n import_names = ['mod1', 'mod2']\n\n def test_something(self):\n # mod1 and mod2 will be available here.\n\n`import_from_names` causes attributes to be imported from modules just like\n`from module import attribute` would. It should be set to a list of tuples\ncontaining the name of the module to import from, and a list of attribute names\nto import. If one of the attribute names is \"*\", then all public attributes are\nimported:\n\n.. code:: python\n\n class ImportFromTestCase(DualTestCase):\n import_from_names = [\n ('mod1', ['attr1', 'attr2']),\n # \"*\" causes all public attributes to be imported.\n ('mod2', ['*']),\n ]\n\n def test_something(self):\n # attr1, attr2 and everything from mod2 will be available here.\n\n============\nFull Example\n============\n\n.. code:: python\n\n from dualtest import DualTestCase\n\n\n class ImportTestCase(DualTestCase):\n import_names = ['mod1', 'mod2']\n\n def test_something(self):\n # mod1 and mod2 will be available here.\n\n\n class ImportFromTestCase(DualTestCase):\n import_from_names = [\n ('mod1', ['attr1', 'attr2']),\n # \"*\" causes all public attributes to be imported.\n ('mod2', ['*']),\n ]\n\n def test_something(self):\n # attr1, attr2 and everything from mod2 will be available here.\n\n=========\nChangelog\n=========\n\n1.0.1\n-----\n\n* Patch imported modules into \"sys.modules\" during tests.\n* Fix error when \"import_from_names\" references a non-existing module.\n* Fix bug when importing '*' from a module.\n* Add module type context when \"subTest\" is called.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "dualtest", "package_url": "https://pypi.org/project/dualtest/", "platform": "", "project_url": "https://pypi.org/project/dualtest/", "project_urls": null, "release_url": "https://pypi.org/project/dualtest/1.0.1/", "requires_dist": null, "requires_python": ">= 3.6", "summary": "Easily test both Python and C versions of modules.", "version": "1.0.1" }, "last_serial": 5296789, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "10b5134213e01ffed1e8631a1c5a3ba1", "sha256": "225d82190222ec06c02151d0449823cfd004f32ded6c083036f1d4703851bb41" }, "downloads": -1, "filename": "dualtest-1.0.tar.gz", "has_sig": false, "md5_digest": "10b5134213e01ffed1e8631a1c5a3ba1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5323, "upload_time": "2018-12-10T05:17:35", "url": "https://files.pythonhosted.org/packages/ec/30/675760d2ce3048ebde6a76d7a4b33c024c1c9f197b6ab0bb2a2aa38edd22/dualtest-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "ff419a71afee1118e7d751ebfddd731a", "sha256": "a6429c0946f936d7a5cdf74681a36fe0630bce0edde9cf1ce2764db4d827d3ca" }, "downloads": -1, "filename": "dualtest-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ff419a71afee1118e7d751ebfddd731a", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.6", "size": 5870, "upload_time": "2019-05-21T09:24:37", "url": "https://files.pythonhosted.org/packages/7f/1c/cebe9c8ab0303d7fd6af6ecce3c846bc09073056cc3a8f5d79dc7ced9d36/dualtest-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ff419a71afee1118e7d751ebfddd731a", "sha256": "a6429c0946f936d7a5cdf74681a36fe0630bce0edde9cf1ce2764db4d827d3ca" }, "downloads": -1, "filename": "dualtest-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ff419a71afee1118e7d751ebfddd731a", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.6", "size": 5870, "upload_time": "2019-05-21T09:24:37", "url": "https://files.pythonhosted.org/packages/7f/1c/cebe9c8ab0303d7fd6af6ecce3c846bc09073056cc3a8f5d79dc7ced9d36/dualtest-1.0.1.tar.gz" } ] }