소스 검색

Fix tests: Make CFG singleton in runtime not at imports loading

Bastien Sevajol (Algoo) 8 년 전
부모
커밋
bdff1069e4
3개의 변경된 파일8개의 추가작업 그리고 6개의 파일을 삭제
  1. 2 2
      tracim/test.ini
  2. 5 2
      tracim/tracim/tests/functional/test_calendar.py
  3. 1 2
      tracim/tracim/tests/library/test_helpers.py

+ 2 - 2
tracim/test.ini 파일 보기

@@ -9,6 +9,8 @@ debug = true
9 9
 # email_to = you@yourdomain.com
10 10
 smtp_server = localhost
11 11
 error_email_from = turbogears@localhost
12
+radicale.server.port = 15232
13
+radicale.client.port = 15232
12 14
 
13 15
 [server:main]
14 16
 use = egg:gearbox#wsgiref
@@ -39,8 +41,6 @@ use = config:development.ini
39 41
 [app:radicale]
40 42
 sqlalchemy.url = postgresql://postgres:dummy@127.0.0.1:5432/tracim_test?client_encoding=utf8
41 43
 radicale.server.filesystem.folder = /tmp/tracim_tests_radicale_fs
42
-radicale.server.port = 15232
43
-radicale.client.port = 15232
44 44
 use = config:development.ini
45 45
 
46 46
 # Add additional test specific configuration options as necessary.

+ 5 - 2
tracim/tracim/tests/functional/test_calendar.py 파일 보기

@@ -10,12 +10,15 @@ from tracim.tests import TestCalendar as BaseTestCalendar
10 10
 
11 11
 
12 12
 class TestCalendar(BaseTestCalendar):
13
+    def setUp(self):
14
+        super().setUp()
15
+        time.sleep(3)  # TODO - 20160606 - Bastien: sleep to wait ...
16
+        # ... radicale daemon started. We should lock something somewhere !
17
+
13 18
     def test_func__radicale_connectivity__ok__nominal_case(self):
14 19
         radicale_base_url = self._get_base_url()
15 20
 
16 21
         try:
17
-            time.sleep(2)  # TODO - 20160606 - Bastien: sleep to wait ...
18
-            # ... radicale daemon started. We should lock something somewhere !
19 22
             response = requests.get(radicale_base_url)
20 23
             eq_(response.status_code, 401, 'Radicale http response is 401')
21 24
         except ConnectionError:

+ 1 - 2
tracim/tracim/tests/library/test_helpers.py 파일 보기

@@ -17,12 +17,11 @@ from tracim.model.serializers import DictLikeClass
17 17
 
18 18
 from tracim.tests import TestStandard
19 19
 
20
-config = CFG.get_instance()
21
-
22 20
 
23 21
 class TestHelpers(TestStandard):
24 22
 
25 23
     def test_is_item_still_editable(self):
24
+        config = CFG.get_instance()
26 25
         item = DictLikeClass()
27 26
 
28 27
         config.DATA_UPDATE_ALLOWED_DURATION = 0