Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3378f28

Browse files
committed
small fixes, improve tests
1 parentdd8c500 commit3378f28

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

‎testgres/config.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def copy(self):
9898
TestgresConfig=testgres_config
9999

100100
# stack of GlobalConfigs
101-
config_stack= [testgres_config]
101+
config_stack= []
102102

103103

104104
defrm_cached_initdb_dirs():
@@ -123,7 +123,7 @@ def pop_config():
123123
Set previous GlobalConfig options from stack.
124124
"""
125125

126-
iflen(config_stack)<=1:
126+
iflen(config_stack)==0:
127127
raiseIndexError('Reached initial config')
128128

129129
# restore popped config
@@ -141,9 +141,10 @@ def scoped_config(**options):
141141
... print(node.execute('select 1'))
142142
"""
143143

144-
# set a new config with options
145-
config=push_config(**options)
146144
try:
145+
# set a new config with options
146+
config=push_config(**options)
147+
147148
# return it
148149
yieldconfig
149150
finally:

‎tests/test_simple.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,16 @@ def test_config_stack(self):
549549
self.assertEqual(c1.cached_initdb_dir,d1)
550550

551551
withscoped_config(cached_initdb_dir=d2)asc2:
552+
553+
stack_size=len(testgres.config.config_stack)
554+
555+
# try to break a stack
556+
withself.assertRaises(TypeError):
557+
withscoped_config(dummy=True):
558+
pass
559+
552560
self.assertEqual(c2.cached_initdb_dir,d2)
561+
self.assertEqual(len(testgres.config.config_stack),stack_size)
553562

554563
self.assertEqual(c1.cached_initdb_dir,d1)
555564

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp