Running unittest with typical test directory structure

Here is an example of how you can run unittests in Python using the typical test directory structure:

# project/
#     main.py
#     tests/
#         __init__.py
#         test_main.py

# In the tests/ directory, you can create a file named `test_main.py` that contains your unittests. 
# Here's an example of what that file might look like:

import unittest

class TestMain(unittest.TestCase):
    def test_addition(self):
        self.assertEqual(1 + 1, 2)

# You can then run the unittests using the following command:

# python -m unittest discover -s project/tests -p "test_*.py"

This runs all the tests in files matching the pattern test_*.py in project/tests/ directory

Watch a course Python - The Practical Guide

Note: The -s option specifies the directory where the tests should be run from, and the -p option specifies the pattern for test files.