File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 23
23
TimeoutException
24
24
25
25
from testgres import \
26
- scoped_config
26
+ TestgresConfig , \
27
+ configure_testgres , \
28
+ scoped_config , \
29
+ pop_config
27
30
28
31
from testgres import \
29
32
NodeStatus , \
@@ -529,6 +532,29 @@ def test_pg_config(self):
529
532
b = get_pg_config ()
530
533
self .assertNotEqual (id (a ), id (b ))
531
534
535
+ def test_config_stack (self ):
536
+ # no such option
537
+ with self .assertRaises (TypeError ):
538
+ configure_testgres (dummy = True )
539
+
540
+ # we have only 1 config in stack
541
+ with self .assertRaises (IndexError ):
542
+ pop_config ()
543
+
544
+ d0 = TestgresConfig .cached_initdb_dir
545
+ d1 = 'dummy_abc'
546
+ d2 = 'dummy_def'
547
+
548
+ with scoped_config (cached_initdb_dir = d1 ) as c1 :
549
+ self .assertEqual (c1 .cached_initdb_dir , d1 )
550
+
551
+ with scoped_config (cached_initdb_dir = d2 ) as c2 :
552
+ self .assertEqual (c2 .cached_initdb_dir , d2 )
553
+
554
+ self .assertEqual (c1 .cached_initdb_dir , d1 )
555
+
556
+ self .assertEqual (TestgresConfig .cached_initdb_dir , d0 )
557
+
532
558
def test_unix_sockets (self ):
533
559
with get_new_node () as node :
534
560
node .init (unix_sockets = False , allow_streaming = True )
You can’t perform that action at this time.
0 commit comments