File tree Expand file tree Collapse file tree 1 file changed +22
-7
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +22
-7
lines changed
Original file line number Diff line number Diff line change 3
3
from .helpers .ptrack_helpers import ProbackupTest , ProbackupException
4
4
import locale
5
5
6
-
7
6
class OptionTest (ProbackupTest , unittest .TestCase ):
8
7
9
8
# @unittest.skip("skip")
@@ -220,12 +219,28 @@ def test_options_5(self):
220
219
def test_help_6 (self ):
221
220
"""help options"""
222
221
if ProbackupTest .enable_nls :
223
- self .test_env ['LC_ALL' ] = 'ru_RU.utf-8'
224
- with open (os .path .join (self .dir_path , "expected/option_help_ru.out" ), "rb" ) as help_out :
225
- self .assertEqual (
226
- self .run_pb (["--help" ]),
227
- help_out .read ().decode ("utf-8" )
228
- )
222
+ if check_locale ('ru_RU.utf-8' ):
223
+ self .test_env ['LC_ALL' ] = 'ru_RU.utf-8'
224
+ with open (os .path .join (self .dir_path , "expected/option_help_ru.out" ), "rb" ) as help_out :
225
+ self .assertEqual (
226
+ self .run_pb (["--help" ]),
227
+ help_out .read ().decode ("utf-8" )
228
+ )
229
+ else :
230
+ self .skipTest (
231
+ "Locale ru_RU.utf-8 doesn't work. You need install ru_RU.utf-8 locale for this test" )
229
232
else :
230
233
self .skipTest (
231
234
'You need configure PostgreSQL with --enabled-nls option for this test' )
235
+
236
+
237
+ def check_locale (locale_name ):
238
+ ret = True
239
+ old_locale = locale .setlocale (locale .LC_CTYPE ,"" )
240
+ try :
241
+ locale .setlocale (locale .LC_CTYPE , locale_name )
242
+ except locale .Error :
243
+ ret = False
244
+ finally :
245
+ locale .setlocale (locale .LC_CTYPE , old_locale )
246
+ return ret
You can’t perform that action at this time.
0 commit comments