瀏覽代碼

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

Bastien Sevajol (Algoo) 9 年之前
父節點
當前提交
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
 # email_to = you@yourdomain.com
9
 # email_to = you@yourdomain.com
10
 smtp_server = localhost
10
 smtp_server = localhost
11
 error_email_from = turbogears@localhost
11
 error_email_from = turbogears@localhost
12
+radicale.server.port = 15232
13
+radicale.client.port = 15232
12
 
14
 
13
 [server:main]
15
 [server:main]
14
 use = egg:gearbox#wsgiref
16
 use = egg:gearbox#wsgiref
39
 [app:radicale]
41
 [app:radicale]
40
 sqlalchemy.url = postgresql://postgres:dummy@127.0.0.1:5432/tracim_test?client_encoding=utf8
42
 sqlalchemy.url = postgresql://postgres:dummy@127.0.0.1:5432/tracim_test?client_encoding=utf8
41
 radicale.server.filesystem.folder = /tmp/tracim_tests_radicale_fs
43
 radicale.server.filesystem.folder = /tmp/tracim_tests_radicale_fs
42
-radicale.server.port = 15232
43
-radicale.client.port = 15232
44
 use = config:development.ini
44
 use = config:development.ini
45
 
45
 
46
 # Add additional test specific configuration options as necessary.
46
 # Add additional test specific configuration options as necessary.

+ 5 - 2
tracim/tracim/tests/functional/test_calendar.py 查看文件

10
 
10
 
11
 
11
 
12
 class TestCalendar(BaseTestCalendar):
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
     def test_func__radicale_connectivity__ok__nominal_case(self):
18
     def test_func__radicale_connectivity__ok__nominal_case(self):
14
         radicale_base_url = self._get_base_url()
19
         radicale_base_url = self._get_base_url()
15
 
20
 
16
         try:
21
         try:
17
-            time.sleep(2)  # TODO - 20160606 - Bastien: sleep to wait ...
18
-            # ... radicale daemon started. We should lock something somewhere !
19
             response = requests.get(radicale_base_url)
22
             response = requests.get(radicale_base_url)
20
             eq_(response.status_code, 401, 'Radicale http response is 401')
23
             eq_(response.status_code, 401, 'Radicale http response is 401')
21
         except ConnectionError:
24
         except ConnectionError:

+ 1 - 2
tracim/tracim/tests/library/test_helpers.py 查看文件

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