# What is it for?
I use it when I need to debug only one test and I don't want to deal with command line parameters or modification of unittest.main().
# Installation
```bash
!pip install focused_unittest
```
# Usage
```
# test_example.py
import unittest
from focused_unittests import FocusedTestCase, focus
class TestExample(FocusedTestCase):
@focus
def test_add(self):
self.assertEqual(2 + 3, 5)
@focus
def test_subtract(self):
self.assertEqual(3 - 2, 1)
def test_multiply(self):
self.assertEqual(3 * 2, 6)
def test_divide(self):
self.assertEqual(6 / 2, 3)
if __name__ == '__main__':
unittest.main()
```
Basically I change `unittest.TestCase` to `FocusedTestCase` and I add `@focus` decorator to the methods I need to debug. Now I can debug with just F5 in vscode.
Raw data
{
"_id": null,
"home_page": "https://github.com/barsv/focused_unittest",
"name": "focused-unittest",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Stan",
"author_email": "barsv85@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/89/92/482fe8bf6201d1be6520892df115cde0c34039bcad71e350662ef4b9332d/focused_unittest-0.1.1.tar.gz",
"platform": null,
"description": "# What is it for?\n\nI use it when I need to debug only one test and I don't want to deal with command line parameters or modification of unittest.main().\n\n# Installation\n\n```bash\n!pip install focused_unittest\n```\n\n# Usage\n\n```\n# test_example.py\nimport unittest\nfrom focused_unittests import FocusedTestCase, focus\n\nclass TestExample(FocusedTestCase):\n\n @focus\n def test_add(self):\n self.assertEqual(2 + 3, 5)\n\n @focus\n def test_subtract(self):\n self.assertEqual(3 - 2, 1)\n\n def test_multiply(self):\n self.assertEqual(3 * 2, 6)\n\n def test_divide(self):\n self.assertEqual(6 / 2, 3)\n\nif __name__ == '__main__':\n unittest.main()\n```\n\nBasically I change `unittest.TestCase` to `FocusedTestCase` and I add `@focus` decorator to the methods I need to debug. Now I can debug with just F5 in vscode.\n",
"bugtrack_url": null,
"license": null,
"summary": "Decorator to select only one unit test to be run.",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/barsv/focused_unittest"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "52eb16b43196014960a78a1a267094dc5f6bb8cadb194648a1649199756c9a42",
"md5": "725a4438408cb55a325d1c18101f9875",
"sha256": "dc46a95f1d0e965a1d36391abcb2c4198d3676b8a3c2bd41306a5aea4f4dc033"
},
"downloads": -1,
"filename": "focused_unittest-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "725a4438408cb55a325d1c18101f9875",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 3306,
"upload_time": "2024-07-07T11:25:12",
"upload_time_iso_8601": "2024-07-07T11:25:12.488788Z",
"url": "https://files.pythonhosted.org/packages/52/eb/16b43196014960a78a1a267094dc5f6bb8cadb194648a1649199756c9a42/focused_unittest-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8992482fe8bf6201d1be6520892df115cde0c34039bcad71e350662ef4b9332d",
"md5": "43b50742bec65e6662cd3eaa0403baa3",
"sha256": "868d9bffb6b139c24c218959785b6462bc3f5773b0d8950c3cf8a99436fb05fa"
},
"downloads": -1,
"filename": "focused_unittest-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "43b50742bec65e6662cd3eaa0403baa3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 2877,
"upload_time": "2024-07-07T11:25:14",
"upload_time_iso_8601": "2024-07-07T11:25:14.083416Z",
"url": "https://files.pythonhosted.org/packages/89/92/482fe8bf6201d1be6520892df115cde0c34039bcad71e350662ef4b9332d/focused_unittest-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-07 11:25:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "barsv",
"github_project": "focused_unittest",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "focused-unittest"
}