Commits

cleemesser committed 8e9ed44

switch to setupClass/tearDownClass for starting/stopping the server

  • Participants
  • Parent commits 49744a7

Comments (0)

Files changed (1)

File tests/test_project.py

     
 
 class TestDeveloperMode(unittest.TestCase):
-
-    def setUp(self):
+    ajaxurl = r'http://localhost:8000/testajax/' # remember it needs to end in a slash
+    @classmethod
+    def setUpClass(clss):
         launch_project_developer_mode()
         time.sleep(1) # it takes a little time for the server to get started
-        self.session = requests.Session()
+        #self.session = requests.Session()
 
-        self.ajaxurl = r'http://localhost:8000/testajax/' # remember it needs to end in a slash
-
-    def tearDown(self):
+        #self.ajaxurl = r'http://localhost:8000/testajax/' # remember it needs to end in a slash
+    @classmethod
+    def tearDownClass(clss):
         stop_project()
 
     def test_django_root(self):
         time.sleep(1)
+        self.session = requests.Session()
         r = self.session.get(r'http://localhost:8000/')
         self.csrftoken =  r.cookies['csrftoken']
     
         
     def test_http_verbs(self):
         # first get the csrftoken
+        self.session = requests.Session()
         r = self.session.get(r'http://localhost:8000/') # a session allows for persistent cookies and things
         csrftoken =  r.cookies['csrftoken']
         self.csrftoken = csrftoken