cd ~/torrent-downloader
python3 run_tests.pyExpected Result:
Status: β ALL TESTS PASSED
Tests run: 96
β Passed: 96
Time: 1.77s
| File | Tests | What It Tests |
|---|---|---|
tests/test_utils.py |
32 | Utility functions (formatting, sanitization) |
tests/test_validation.py |
29 | Input validation & security |
tests/test_single_instance.py |
8 | IPC communication |
tests/test_torrent_core.py |
14 | Libtorrent integration |
tests/test_remove_torrents.py |
13 | Remove/delete functionality |
| Total | 96 | All functionality |
# Run all tests
python3 run_tests.py
# Run specific test file
python3 run_tests.py --suite test_utils
python3 run_tests.py --suite test_validation
python3 run_tests.py --suite test_single_instance
python3 run_tests.py --suite test_torrent_core
# List all tests
python3 run_tests.py --list
# Quiet mode (minimal output)
python3 run_tests.py --quiet
# Verbose mode
python3 run_tests.py --verbose- Size formatting (B, KiB, MiB, GiB, TiB, PiB)
- Speed formatting
- Time formatting
- Filename sanitization
- Magnet link validation
- Path traversal prevention
- Command injection prevention
- Script injection prevention
- SQL injection prevention
- Null byte handling
- Bandwidth limits
- Magnet links (format, hash, length)
- File paths
- Filenames
- Session creation
- Magnet parsing
- Resume data
- Info hash extraction
- Bencode/bdecode
- Socket creation/cleanup
- IPC communication
- Instance detection
- Multiple clients
- Create/edit test file in
tests/directory - Run tests:
python3 run_tests.py - Tests are auto-discovered!
Example:
# tests/test_my_feature.py
import unittest
class TestMyFeature(unittest.TestCase):
def test_something(self):
self.assertTrue(True)See TEST_SUITE_GUIDE.md for complete documentation including:
- Detailed test descriptions
- CI/CD integration
- Best practices
- Troubleshooting
Status: β 96/96 tests passing Coverage: 98% Runtime: ~1.8 seconds