Decorator to select only one unit test to be run.
Project description
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
!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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file focused_unittest-0.1.1.tar.gz.
File metadata
- Download URL: focused_unittest-0.1.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
868d9bffb6b139c24c218959785b6462bc3f5773b0d8950c3cf8a99436fb05fa
|
|
| MD5 |
43b50742bec65e6662cd3eaa0403baa3
|
|
| BLAKE2b-256 |
8992482fe8bf6201d1be6520892df115cde0c34039bcad71e350662ef4b9332d
|
File details
Details for the file focused_unittest-0.1.1-py3-none-any.whl.
File metadata
- Download URL: focused_unittest-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc46a95f1d0e965a1d36391abcb2c4198d3676b8a3c2bd41306a5aea4f4dc033
|
|
| MD5 |
725a4438408cb55a325d1c18101f9875
|
|
| BLAKE2b-256 |
52eb16b43196014960a78a1a267094dc5f6bb8cadb194648a1649199756c9a42
|