Aug-12-2020, 05:44 AM
I am trying to go through Test-Driven Development with Python.
I am currently in section 1 chapter 2.
I have installed Django and selenium.
I have made manage.py
When I run functional_tests.py per the book it doesn't run the tests. Why?
I am currently in section 1 chapter 2.
I have installed Django and selenium.
I have made manage.py
import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "superlists.settings") try: from django.core.management import execute_from_command_line except ImportError: try: import django except ImportError: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) raise execute_from_command_line(sys.argv)and functional_tests.py
from selenium import webdriver import unittest class NewVisitorTest(unittest.TestCase): def setUp(self): self.browser = webdriver.Firefox() def tearDown(self): self.browser.quit() def start_list(self): self.browser.get('http://localhost:8000') self.assertIn('To-Do', self.browser.title) self.fail("Finish the test!") if __name__ == "__main__": unittest.main()I run
manage.py runserver
to start the server.When I run functional_tests.py per the book it doesn't run the tests. Why?

Output:(virtualenv) PS C:\Users\User\mystuff\TDD_python> python functional_test.py
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
(virtualenv) PS C:\Users\User\mystuff\TDD_python>