{ "info": { "author": "Michael England", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "unittest-sandbox\n================\n\nunittest-sandbox provides a @sandbox decorator which ensures unit test\nmethods do not make any socket/web requests during test execution. Note:\nThis currently only works with Python 3.\n\nInstallation\n------------\n\nTo install run: ``pip install unittest_sandbox``\n\nExample usage\n-------------\n\n.. code:: python\n\n from unittest import TestCase\n\n import requests\n\n from unittest_sandbox import InternetAccessBlockedException, sandbox\n\n # The @sandbox() decorator can be applied to methods individually like below\n\n class RequestTests(TestCase):\n def test_non_request_works(self):\n self.assertEqual(1 + 1, 2)\n\n @sandbox()\n def test_web_request_raises_exception_when_sandbox_decorator_is_applied(self):\n # If a web request is sent in a test method wrapped with the @sandbox decorator,\n # an InternetAccessBlockedException will be raised.\n\n with self.assertRaises(InternetAccessBlockedException):\n requests.get('https://www.google.com')\n\n # The @sandbox() decorator can also be applied to the class as a whole. This is the same as decorating\n # all 'test_' methods with @sandbox()\n\n @sandbox()\n class RequestTests(TestCase):\n def test_non_request_works(self):\n self.assertEqual(1 + 1, 2)\n\n def test_web_request_raises_exception_when_sandbox_decorator_is_applied(self):\n # If a web request is sent in a test method wrapped with the @sandbox decorator,\n # an InternetAccessBlockedException will be raised.\n\n with self.assertRaises(InternetAccessBlockedException):\n requests.get('https://www.google.com')\n\n # A function can also be imported and called to prevent any web requests from occurring.\n # For example, this could be called at the start of a Django settings file used by the test runner to\n # ensure that no web requests are made by the tests.\n\n from unittest_sandbox import block_socket_access\n\n block_socket_access()\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mikeengland/unittest_sandbox", "keywords": "unittest unittests testcase sandbox internet block decorator socket requests urllib", "license": "Apache License Version 2.0", "maintainer": "", "maintainer_email": "", "name": "unittest_sandbox", "package_url": "https://pypi.org/project/unittest_sandbox/", "platform": "", "project_url": "https://pypi.org/project/unittest_sandbox/", "project_urls": { "Homepage": "https://github.com/mikeengland/unittest_sandbox" }, "release_url": "https://pypi.org/project/unittest_sandbox/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "unittest_sandbox provides a @sandbox decorator which ensures unit test methods do not make any socket/web requests during test execution.", "version": "1.1.0" }, "last_serial": 3201951, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "315eba63eb03c5ec61bc542bdf1c522a", "sha256": "9b968ab4f577fe4e139ca057a62d3240de02aa318acde715f3a78a504ba01fb9" }, "downloads": -1, "filename": "unittest_sandbox-1.0.0.tar.gz", "has_sig": false, "md5_digest": "315eba63eb03c5ec61bc542bdf1c522a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1918, "upload_time": "2017-07-23T13:43:54", "url": "https://files.pythonhosted.org/packages/28/1c/2ee3265b78f8d7d62b63d3e6808d118863c68b129fa1ebcfb5938a1b6e36/unittest_sandbox-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "67011dd57a2504827e9734bd2687ea11", "sha256": "e2eb4d80593f635d8efb36a6f53609fa99e74fbf7014b6f6154b6f1689087272" }, "downloads": -1, "filename": "unittest_sandbox-1.0.1.tar.gz", "has_sig": false, "md5_digest": "67011dd57a2504827e9734bd2687ea11", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2303, "upload_time": "2017-07-23T13:53:11", "url": "https://files.pythonhosted.org/packages/64/b4/ba9ab2593ffe67787b0dec4261e190781ef6cc844ebbad40f0b70d81f96c/unittest_sandbox-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "61680f133362c271b0add308f25a3f24", "sha256": "50e7485465ce8e57b80d4750d5a0aa32647762820edee4d1381a0f43a72afbcf" }, "downloads": -1, "filename": "unittest_sandbox-1.0.2.tar.gz", "has_sig": false, "md5_digest": "61680f133362c271b0add308f25a3f24", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2300, "upload_time": "2017-07-23T14:09:18", "url": "https://files.pythonhosted.org/packages/13/dc/4dcedb01ebe8398437640b0956c42a2a6faf82ada0b3b2820ffab8b0c89b/unittest_sandbox-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "d26e4c41b07a82859a72933b8e642230", "sha256": "c3e49d6d2a778110fe0c328021a0b9be9a73f6fba4a47c45a43c481fbe322d60" }, "downloads": -1, "filename": "unittest_sandbox-1.0.3.tar.gz", "has_sig": false, "md5_digest": "d26e4c41b07a82859a72933b8e642230", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2473, "upload_time": "2017-08-12T16:56:31", "url": "https://files.pythonhosted.org/packages/ab/80/e0fd152e42038b9e412a62a0e46d7af44f19984da7e6954c1a3e0d8cbe41/unittest_sandbox-1.0.3.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "15c72f33461fc681085df4a1c0d5cd3c", "sha256": "8bfd005ac1d61330ea238d7cd2fd45ad77572f1beb1cad7739136086a987c3ae" }, "downloads": -1, "filename": "unittest_sandbox-1.1.0.tar.gz", "has_sig": false, "md5_digest": "15c72f33461fc681085df4a1c0d5cd3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2666, "upload_time": "2017-09-25T19:42:40", "url": "https://files.pythonhosted.org/packages/ee/9a/fb27b927b5a29c620d818051ec0e847d710b17bd07c1b8c78b7fb5c35614/unittest_sandbox-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "15c72f33461fc681085df4a1c0d5cd3c", "sha256": "8bfd005ac1d61330ea238d7cd2fd45ad77572f1beb1cad7739136086a987c3ae" }, "downloads": -1, "filename": "unittest_sandbox-1.1.0.tar.gz", "has_sig": false, "md5_digest": "15c72f33461fc681085df4a1c0d5cd3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2666, "upload_time": "2017-09-25T19:42:40", "url": "https://files.pythonhosted.org/packages/ee/9a/fb27b927b5a29c620d818051ec0e847d710b17bd07c1b8c78b7fb5c35614/unittest_sandbox-1.1.0.tar.gz" } ] }