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 2323 TimeoutException
2424
2525from testgres import \
26- scoped_config
26+ TestgresConfig , \
27+ configure_testgres , \
28+ scoped_config , \
29+ pop_config
2730
2831from testgres import \
2932 NodeStatus , \
@@ -529,6 +532,29 @@ def test_pg_config(self):
529532 b = get_pg_config ()
530533 self .assertNotEqual (id (a ), id (b ))
531534
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+
532558 def test_unix_sockets (self ):
533559 with get_new_node () as node :
534560 node .init (unix_sockets = False , allow_streaming = True )
You can’t perform that action at this time.
0 commit comments