8
8
import testgres
9
9
10
10
try :
11
- import lz4 .frame
11
+ import lz4 .frame # noqa: F401
12
+
12
13
HAVE_LZ4 = True
13
14
except ImportError as e :
14
15
HAVE_LZ4 = False
15
16
LZ4_error = e
16
17
17
18
try :
18
- import zstd
19
+ import zstd # noqa: F401
20
+
19
21
HAVE_ZSTD = True
20
22
except ImportError as e :
21
23
HAVE_ZSTD = False
28
30
cache_initdb = False ,
29
31
cached_initdb_dir = False ,
30
32
node_cleanup_full = delete_logs )
31
- except :
32
- pass
33
+ except Exception as e :
34
+ print ( "Can't configure testgres: {0}" . format ( e ))
33
35
34
36
35
37
class Init (object ):
@@ -46,7 +48,7 @@ def __init__(self):
46
48
version = self ._pg_config ['VERSION' ].rstrip ('develalphabetapre' )
47
49
parts = [* version .split (' ' )[1 ].split ('.' ), '0' , '0' ][:3 ]
48
50
parts [0 ] = re .match (r'\d+' , parts [0 ]).group ()
49
- self .pg_config_version = reduce (lambda v , x : v * 100 + int (x ), parts , 0 )
51
+ self .pg_config_version = reduce (lambda v , x : v * 100 + int (x ), parts , 0 )
50
52
51
53
test_env = os .environ .copy ()
52
54
envs_list = [
@@ -133,10 +135,7 @@ def __init__(self):
133
135
134
136
self .probackup_old_path = None
135
137
if 'PGPROBACKUPBIN_OLD' in test_env :
136
- if (
137
- os .path .isfile (test_env ['PGPROBACKUPBIN_OLD' ]) and
138
- os .access (test_env ['PGPROBACKUPBIN_OLD' ], os .X_OK )
139
- ):
138
+ if (os .path .isfile (test_env ['PGPROBACKUPBIN_OLD' ]) and os .access (test_env ['PGPROBACKUPBIN_OLD' ], os .X_OK )):
140
139
self .probackup_old_path = test_env ['PGPROBACKUPBIN_OLD' ]
141
140
else :
142
141
if self .verbose :
@@ -166,8 +165,7 @@ def __init__(self):
166
165
).group (0 )
167
166
168
167
self .remote = test_env .get ('PGPROBACKUP_SSH_REMOTE' , None ) == 'ON'
169
- self .ptrack = test_env .get ('PG_PROBACKUP_PTRACK' , None ) == 'ON' and \
170
- self .pg_config_version >= 110000
168
+ self .ptrack = test_env .get ('PG_PROBACKUP_PTRACK' , None ) == 'ON' and self .pg_config_version >= 110000
171
169
172
170
self .paranoia = test_env .get ('PG_PROBACKUP_PARANOIA' , None ) == 'ON'
173
171
env_compress = test_env .get ('ARCHIVE_COMPRESSION' , None )
@@ -200,4 +198,5 @@ def __init__(self):
200
198
def test_env (self ):
201
199
return self ._test_env .copy ()
202
200
201
+
203
202
init_params = Init ()
0 commit comments