Skip to content

Commit dab3957

Browse files
committed
copy-paste some test fixes
authors: Victoria Shepard and Sergey Fukanchik
1 parent 0cf3d05 commit dab3957

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

tests/helpers/ptrack_helpers.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
# you need os for unittest to work
22
import os
3-
import gc
43
import threading
54
import unittest
6-
from sys import exit, argv, version_info
5+
from sys import exit, argv
76
import signal
87
import subprocess
98
import shutil
10-
import six
119
import testgres
1210
import hashlib
13-
import re
1411
import getpass
15-
import select
1612
from time import sleep
1713
import re
1814
import json
@@ -143,6 +139,7 @@ def __init__(self, message, cmd):
143139
def __str__(self):
144140
return '\n ERROR: {0}\n CMD: {1}'.format(repr(self.message), self.cmd)
145141

142+
146143
class PostgresNodeExtended(testgres.PostgresNode):
147144

148145
def __init__(self, base_dir=None, *args, **kwargs):
@@ -227,6 +224,7 @@ def table_checksum(self, table, dbname="postgres"):
227224
con.close()
228225
return sum.hexdigest()
229226

227+
230228
class ProbackupTest(object):
231229
# Class attributes
232230
enterprise = is_enterprise()
@@ -238,8 +236,13 @@ def __init__(self, *args, **kwargs):
238236
self.nodes_to_cleanup = []
239237

240238
if isinstance(self, unittest.TestCase):
241-
self.module_name = self.id().split('.')[1]
242-
self.fname = self.id().split('.')[3]
239+
try:
240+
self.module_name = self.id().split('.')[-2]
241+
self.fname = self.id().split('.')[-1]
242+
except IndexError:
243+
print("Couldn't get module name and function name from self.id(): `{}`".format(self.id()))
244+
self.module_name = self.module_name if self.module_name else str(self).split('(')[1].split('.')[1]
245+
self.fname = str(self).split('(')[0]
243246

244247
if '-v' in argv or '--verbose' in argv:
245248
self.verbose = True

tests/ptrack_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
1414
def setUp(self):
1515
if self.pg_config_version < self.version_to_num('11.0'):
1616
self.skipTest('You need PostgreSQL >= 11 for this test')
17-
self.fname = self.id().split('.')[3]
1817

1918
# @unittest.skip("skip")
2019
def test_drop_rel_during_backup_ptrack(self):

0 commit comments

Comments
 (0)