@@ -810,8 +810,7 @@ def run_pb(self, command, asynchronous=False, gdb=False, old_binary=False, retur
810810 if self .verbose :
811811 print (self .cmd )
812812 if gdb :
813- #TODO REVIEW XXX no self parameter
814- return GDBobj ([binary_path ] + command , self .verbose )
813+ return GDBobj ([binary_path ] + command , self )
815814 if asynchronous :
816815 return subprocess .Popen (
817816 [binary_path ] + command ,
@@ -1862,8 +1861,7 @@ def compare_pgdata(self, original_pgdata, restored_pgdata, exclusion_dict = dict
18621861 self .assertFalse (fail , error_message )
18631862
18641863 def gdb_attach (self , pid ):
1865- #TODO REVIEW XXX no self parameter
1866- return GDBobj ([str (pid )], self .verbose , attach = True )
1864+ return GDBobj ([str (pid )], self , attach = True )
18671865
18681866 def _check_gdb_flag_or_skip_test (self ):
18691867 if not self .gdb :
@@ -1872,24 +1870,28 @@ def _check_gdb_flag_or_skip_test(self):
18721870 "optimizations for run this test"
18731871 )
18741872
1873+
18751874class GdbException (Exception ):
1876- def __init__ (self , message = False ):
1875+ def __init__ (self , message = " False" ):
18771876 self .message = message
18781877
18791878 def __str__ (self ):
18801879 return '\n ERROR: {0}\n ' .format (repr (self .message ))
18811880
18821881
1883- class GDBobj (ProbackupTest ):
1884- def __init__ (self , cmd , verbose , attach = False ):
1885- self .verbose = verbose
1882+ #TODO REVIEW XXX no inheritance needed
1883+ # class GDBobj(ProbackupTest):
1884+ class GDBobj :
1885+ # TODO REVIEW XXX Type specification env:ProbackupTest is only for python3, is it ok?
1886+ def __init__ (self , cmd , env : ProbackupTest , attach = False ):
1887+ self .verbose = env .verbose
18861888 self .output = ''
18871889
18881890 # Check gdb flag is set up
1889- # if not self .gdb:
1890- # raise GdbException("No `PGPROBACKUP_GDB=on` is set, "
1891- # "test should call ProbackupTest::check_gdb_flag_or_skip_test() on its start "
1892- # "and be skipped")
1891+ if not env .gdb :
1892+ raise GdbException ("No `PGPROBACKUP_GDB=on` is set, "
1893+ "test should call ProbackupTest::check_gdb_flag_or_skip_test() on its start "
1894+ "and be skipped" )
18931895 # Check gdb presense
18941896 try :
18951897 gdb_version , _ = subprocess .Popen (
0 commit comments