Last Updated: February 25, 2016
·
1.85K
· filosottile

Run a single Python unittest

If you maintain your unittest tests as a package, you can run a single one like this

python -m unittest test.test_download.TestDownload.test_NowVideo

tox test.test_download:TestDownload.test_NowVideo

If instead of a package you have plain files, go for this syntax

python test/test_download.py TestDownload.test_NowVideo

but make sure that you have something like this at the end of the test file

if __name__ == '__main__':
    unittest.main()