A test runner finds automated tests, executes them, and reports whether they pass. Think of it as the stage manager for your test suite: it decides which cases perform, and when. section 8.1.2 section 8.10
The surrounding unittest structure gives the runner its work:
- Fixtures prepare data before a test and clean it up afterward. section 8.1.2
- Test cases contain the code that performs tests; unittest defines them as classes. section 8.1.2
- Test suites collect test cases for execution. section 8.1.2
- Python’s default runner searches for files beginning with test_ and runs the cases it finds. section 8.1.2
Django builds on unittest with its own TestCase and runner. The Django runner looks for tests.py files in application directories and methods beginning with test_. Invoke it through the test management command. Django also creates a separate test database, lets tests populate ORM models, and wraps each test method in a transaction that is undone afterward, keeping tests isolated and repeatable. section 8.10 section 8.1.2
Run one test
From the project environment, run `python manage.py test bands.tests.TestBands.test_musician_view` to execute a specific test method instead of the whole suite. section 8.7.2
(venv) RiffMates$ python manage.py test =music
A shortcut command can select every test whose name contains a matching term, such as `python manage.py test =music`. section 8.7.2




