7
7
# you should have received as part of this distribution.
8
8
9
9
from datetime import datetime
10
+ import multiprocessing
10
11
import os
11
12
import os .path
12
13
import shutil
19
20
from couchdb .tests import testutil
20
21
21
22
23
+ def _current_pid ():
24
+ return multiprocessing .current_process ().pid
25
+
26
+
22
27
class ServerTestCase (testutil .TempDatabaseMixin , unittest .TestCase ):
23
28
24
29
def test_init_with_resource (self ):
@@ -481,7 +486,9 @@ def test_changes_releases_conn(self):
481
486
# that the HTTP connection made it to the pool.
482
487
list (self .db .changes (feed = 'continuous' , timeout = 0 ))
483
488
scheme , netloc = util .urlsplit (client .DEFAULT_BASE_URL )[:2 ]
484
- self .assertTrue (self .db .resource .session .connection_pool .conns [(scheme , netloc )])
489
+ current_pid = _current_pid ()
490
+ key = (current_pid , scheme , netloc )
491
+ self .assertTrue (self .db .resource .session .connection_pool .conns [key ])
485
492
486
493
def test_changes_releases_conn_when_lastseq (self ):
487
494
# Consume a changes feed, stopping at the 'last_seq' item, i.e. don't
@@ -490,8 +497,10 @@ def test_changes_releases_conn_when_lastseq(self):
490
497
for obj in self .db .changes (feed = 'continuous' , timeout = 0 ):
491
498
if 'last_seq' in obj :
492
499
break
500
+ current_pid = _current_pid ()
493
501
scheme , netloc = util .urlsplit (client .DEFAULT_BASE_URL )[:2 ]
494
- self .assertTrue (self .db .resource .session .connection_pool .conns [(scheme , netloc )])
502
+ key = (current_pid , current_pid , scheme , netloc )
503
+ self .assertTrue (self .db .resource .session .connection_pool .conns [key ])
495
504
496
505
def test_changes_conn_usable (self ):
497
506
# Consume a changes feed to get a used connection in the pool.
0 commit comments