Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python TDD
#1
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
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? Wall
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>
Reply


Messages In This Thread
Python TDD - by mcmxl22 - Aug-12-2020, 05:44 AM
RE: Python TDD - by ndc85430 - Aug-12-2020, 06:31 AM
RE: Python TDD - by mcmxl22 - Aug-12-2020, 06:36 AM
RE: Python TDD - by ndc85430 - Aug-12-2020, 06:39 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020