diff --git a/tests/backup_test.py b/tests/backup_test.py index b8bc07e2..da31f25f 100644 --- a/tests/backup_test.py +++ b/tests/backup_test.py @@ -2,8 +2,6 @@ import unittest import os from time import sleep from .helpers.ptrack_helpers import ProbackupTest, ProbackupException -from testgres import stop_all, clean_all -import shutil class BackupTest(ProbackupTest, unittest.TestCase): diff --git a/tests/delete_test.py b/tests/delete_test.py index c6120fd3..593bd83c 100644 --- a/tests/delete_test.py +++ b/tests/delete_test.py @@ -1,9 +1,7 @@ import unittest import os from .helpers.ptrack_helpers import ProbackupTest, ProbackupException -from testgres import stop_all, clean_all import subprocess -import shutil class DeleteTest(ProbackupTest, unittest.TestCase): diff --git a/tests/false_positive.py b/tests/false_positive.py index 6d35c21a..00477524 100644 --- a/tests/false_positive.py +++ b/tests/false_positive.py @@ -2,9 +2,7 @@ import unittest import os from .helpers.ptrack_helpers import ProbackupTest, ProbackupException from datetime import datetime, timedelta -from testgres import stop_all, clean_all import subprocess -import shutil class FalsePositive(ProbackupTest, unittest.TestCase): diff --git a/tests/init_test.py b/tests/init_test.py index 25cf969e..52699f4f 100644 --- a/tests/init_test.py +++ b/tests/init_test.py @@ -1,10 +1,6 @@ -import unittest -from sys import exit import os -from os import path +import unittest from .helpers.ptrack_helpers import dir_files, ProbackupTest, ProbackupException -from testgres import stop_all, clean_all -import shutil class InitTest(ProbackupTest, unittest.TestCase): @@ -67,7 +63,7 @@ class InitTest(ProbackupTest, unittest.TestCase): backup_dir = os.path.join(self.tmp_path, self.module_name, fname, 'backup') node = self.make_simple_node(base_dir="{0}/{1}/node".format(self.module_name, fname)) try: - self.run_pb(["init", "-B", path.relpath("%s/backup" % node.base_dir, self.dir_path)]) + self.run_pb(["init", "-B", os.path.relpath("%s/backup" % node.base_dir, self.dir_path)]) self.assertEqual(1, 0, 'Expecting Error due to initialization with non-absolute path in --backup-path. Output: {0} \n CMD: {1}'.format( repr(self.output), self.cmd)) except ProbackupException as e: diff --git a/tests/option_test.py b/tests/option_test.py index 359f0fa8..a05a0c44 100644 --- a/tests/option_test.py +++ b/tests/option_test.py @@ -1,8 +1,6 @@ import unittest import os from .helpers.ptrack_helpers import ProbackupTest, ProbackupException -from testgres import stop_all, clean_all -import shutil class OptionTest(ProbackupTest, unittest.TestCase): diff --git a/tests/pgpro560.py b/tests/pgpro560.py index d2482cff..1654636e 100644 --- a/tests/pgpro560.py +++ b/tests/pgpro560.py @@ -2,9 +2,7 @@ import os import unittest from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, idx_ptrack from datetime import datetime, timedelta -from testgres import stop_all, clean_all import subprocess -import shutil class CheckSystemID(ProbackupTest, unittest.TestCase): diff --git a/tests/pgpro589.py b/tests/pgpro589.py index 062cae21..c15cd4aa 100644 --- a/tests/pgpro589.py +++ b/tests/pgpro589.py @@ -2,9 +2,7 @@ import os import unittest from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, idx_ptrack from datetime import datetime, timedelta -from testgres import stop_all, clean_all import subprocess -import shutil class ArchiveCheck(ProbackupTest, unittest.TestCase): diff --git a/tests/ptrack_clean.py b/tests/ptrack_clean.py index d0b7c21c..54d7f8a4 100644 --- a/tests/ptrack_clean.py +++ b/tests/ptrack_clean.py @@ -1,8 +1,6 @@ import os import unittest -from testgres import stop_all, clean_all from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack -import shutil class SimpleTest(ProbackupTest, unittest.TestCase): diff --git a/tests/ptrack_cluster.py b/tests/ptrack_cluster.py index 9e913dcb..13ea7678 100644 --- a/tests/ptrack_cluster.py +++ b/tests/ptrack_cluster.py @@ -1,8 +1,6 @@ import os import unittest -from testgres import stop_all, clean_all from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack -import shutil class SimpleTest(ProbackupTest, unittest.TestCase): diff --git a/tests/ptrack_move_to_tablespace.py b/tests/ptrack_move_to_tablespace.py index 2b2b605e..41a310eb 100644 --- a/tests/ptrack_move_to_tablespace.py +++ b/tests/ptrack_move_to_tablespace.py @@ -1,8 +1,6 @@ import os import unittest -from testgres import clean_all, stop_all from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack -import shutil class SimpleTest(ProbackupTest, unittest.TestCase): @@ -10,11 +8,6 @@ class SimpleTest(ProbackupTest, unittest.TestCase): super(SimpleTest, self).__init__(*args, **kwargs) self.module_name = 'ptrack_move_to_tablespace' - # @classmethod - # def tearDownClass(cls): - # clean_all() - # shutil.rmtree(os.path.join(self.tmp_path, self.module_name), ignore_errors=True) - # @unittest.skip("skip") # @unittest.expectedFailure def test_ptrack_recovery(self): diff --git a/tests/ptrack_recovery.py b/tests/ptrack_recovery.py index cdb0c4ef..abc7a751 100644 --- a/tests/ptrack_recovery.py +++ b/tests/ptrack_recovery.py @@ -1,9 +1,7 @@ import os import unittest from sys import exit -from testgres import clean_all, stop_all from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack -import shutil class SimpleTest(ProbackupTest, unittest.TestCase): diff --git a/tests/ptrack_vacuum.py b/tests/ptrack_vacuum.py index 4284a100..fa8d145f 100644 --- a/tests/ptrack_vacuum.py +++ b/tests/ptrack_vacuum.py @@ -1,8 +1,6 @@ import os import unittest -from testgres import stop_all, clean_all from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack -import shutil class SimpleTest(ProbackupTest, unittest.TestCase): @@ -10,11 +8,6 @@ class SimpleTest(ProbackupTest, unittest.TestCase): super(SimpleTest, self).__init__(*args, **kwargs) self.module_name = 'ptrack_vacuum' - # @classmethod - # def tearDownClass(cls): - # clean_all() - # shutil.rmtree(os.path.join(self.tmp_path, self.module_name), ignore_errors=True) - # @unittest.skip("skip") # @unittest.expectedFailure def test_ptrack_vacuum(self): diff --git a/tests/ptrack_vacuum_bits_frozen.py b/tests/ptrack_vacuum_bits_frozen.py index cc785ce3..e41bb265 100644 --- a/tests/ptrack_vacuum_bits_frozen.py +++ b/tests/ptrack_vacuum_bits_frozen.py @@ -1,8 +1,6 @@ import os import unittest -from testgres import stop_all, clean_all from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack -import shutil class SimpleTest(ProbackupTest, unittest.TestCase): @@ -10,11 +8,6 @@ class SimpleTest(ProbackupTest, unittest.TestCase): super(SimpleTest, self).__init__(*args, **kwargs) self.module_name = 'ptrack_vacuum_bits_frozen' - # @classmethod - # def tearDownClass(cls): - # clean_all() - # shutil.rmtree(os.path.join(self.tmp_path, self.module_name), ignore_errors=True) - # @unittest.skip("skip") # @unittest.expectedFailure def test_ptrack_vacuum_bits_frozen(self): diff --git a/tests/ptrack_vacuum_bits_visibility.py b/tests/ptrack_vacuum_bits_visibility.py index fc206eb9..a52325d7 100644 --- a/tests/ptrack_vacuum_bits_visibility.py +++ b/tests/ptrack_vacuum_bits_visibility.py @@ -1,8 +1,6 @@ import os import unittest -from testgres import stop_all, clean_all from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack -import shutil class SimpleTest(ProbackupTest, unittest.TestCase): @@ -10,11 +8,6 @@ class SimpleTest(ProbackupTest, unittest.TestCase): super(SimpleTest, self).__init__(*args, **kwargs) self.module_name = 'ptrack_vacuum_bits_visibility' - # @classmethod - # def tearDownClass(cls): - # clean_all() - # shutil.rmtree(os.path.join(self.tmp_path, self.module_name), ignore_errors=True) - # @unittest.skip("skip") # @unittest.expectedFailure def test_ptrack_vacuum_bits_visibility(self): diff --git a/tests/ptrack_vacuum_full.py b/tests/ptrack_vacuum_full.py index 15bc9486..592821a0 100644 --- a/tests/ptrack_vacuum_full.py +++ b/tests/ptrack_vacuum_full.py @@ -1,8 +1,6 @@ import os import unittest -from testgres import stop_all, clean_all from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack -import shutil class SimpleTest(ProbackupTest, unittest.TestCase): diff --git a/tests/ptrack_vacuum_truncate.py b/tests/ptrack_vacuum_truncate.py index 34f555b2..3bd54b69 100644 --- a/tests/ptrack_vacuum_truncate.py +++ b/tests/ptrack_vacuum_truncate.py @@ -1,8 +1,6 @@ import os import unittest -from testgres import stop_all, clean_all from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack -import shutil class SimpleTest(ProbackupTest, unittest.TestCase): @@ -10,11 +8,6 @@ class SimpleTest(ProbackupTest, unittest.TestCase): super(SimpleTest, self).__init__(*args, **kwargs) self.module_name = 'ptrack_vacuum_truncate' - # @classmethod - # def tearDownClass(self): - # clean_all() - # shutil.rmtree(os.path.join(self.tmp_path, self.module_name), ignore_errors=True) - # @unittest.skip("skip") # @unittest.expectedFailure def test_ptrack_vacuum_truncate(self): diff --git a/tests/replica.py b/tests/replica.py index 7e2745c2..b74afaad 100644 --- a/tests/replica.py +++ b/tests/replica.py @@ -1,12 +1,8 @@ -import unittest import os +import unittest from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, idx_ptrack from datetime import datetime, timedelta -from testgres import stop_all, clean_all import subprocess -from sys import exit -import time -import shutil class ReplicaTest(ProbackupTest, unittest.TestCase): @@ -15,11 +11,6 @@ class ReplicaTest(ProbackupTest, unittest.TestCase): super(ReplicaTest, self).__init__(*args, **kwargs) self.module_name = 'replica' - # @classmethod - # def tearDownClass(cls): - # clean_all() - # shutil.rmtree(os.path.join(self.tmp_path, self.module_name), ignore_errors=True) - # @unittest.skip("skip") # @unittest.expectedFailure def test_replica_stream_full_backup(self): diff --git a/tests/restore_test.py b/tests/restore_test.py index 015030f5..4715e2a7 100644 --- a/tests/restore_test.py +++ b/tests/restore_test.py @@ -1,10 +1,8 @@ -import unittest import os +import unittest from .helpers.ptrack_helpers import ProbackupTest, ProbackupException -from testgres import stop_all, clean_all import subprocess from datetime import datetime -from sys import exit class RestoreTest(ProbackupTest, unittest.TestCase): diff --git a/tests/retention_test.py b/tests/retention_test.py index 750deaf3..d7702793 100644 --- a/tests/retention_test.py +++ b/tests/retention_test.py @@ -1,10 +1,7 @@ -import unittest import os +import unittest from datetime import datetime, timedelta -from os import path, listdir from .helpers.ptrack_helpers import ProbackupTest -from testgres import stop_all, clean_all -import shutil class RetentionTest(ProbackupTest, unittest.TestCase): @@ -52,7 +49,7 @@ class RetentionTest(ProbackupTest, unittest.TestCase): min_wal = line[31:-1] elif line.startswith("INFO: removed max WAL segment"): max_wal = line[31:-1] - for wal_name in listdir(os.path.join(backup_dir, 'wal', 'node')): + for wal_name in os.listdir(os.path.join(backup_dir, 'wal', 'node')): if not wal_name.endswith(".backup"): #wal_name_b = wal_name.encode('ascii') self.assertEqual(wal_name[8:] > min_wal[8:], True) @@ -85,12 +82,12 @@ class RetentionTest(ProbackupTest, unittest.TestCase): # Make backup to be keeped self.backup_node(backup_dir, 'node', node) - backups = path.join(backup_dir, 'backups', 'node') + backups = os.path.join(backup_dir, 'backups', 'node') days_delta = 5 - for backup in listdir(backups): + for backup in os.listdir(backups): if backup == 'pg_probackup.conf': continue - with open(path.join(backups, backup, "backup.control"), "a") as conf: + with open(os.path.join(backups, backup, "backup.control"), "a") as conf: conf.write("recovery_time='{:%Y-%m-%d %H:%M:%S}'\n".format( datetime.now() - timedelta(days=days_delta))) days_delta -= 1 diff --git a/tests/show_test.py b/tests/show_test.py index edd50dbe..4a3df501 100644 --- a/tests/show_test.py +++ b/tests/show_test.py @@ -1,9 +1,6 @@ -import unittest import os -from os import path +import unittest from .helpers.ptrack_helpers import ProbackupTest -from testgres import stop_all, clean_all -import shutil class OptionTest(ProbackupTest, unittest.TestCase): @@ -55,7 +52,7 @@ class OptionTest(ProbackupTest, unittest.TestCase): backup_id = self.backup_node(backup_dir, 'node', node) # delete file which belong to backup - file = path.join(backup_dir, "backups", "node", backup_id, "database", "postgresql.conf") + file = os.path.join(backup_dir, "backups", "node", backup_id, "database", "postgresql.conf") os.remove(file) self.validate_pb(backup_dir, 'node', backup_id) diff --git a/tests/validate_test.py b/tests/validate_test.py index ffdc3660..20f823de 100644 --- a/tests/validate_test.py +++ b/tests/validate_test.py @@ -1,10 +1,8 @@ -import unittest import os +import unittest from .helpers.ptrack_helpers import ProbackupTest, ProbackupException from datetime import datetime, timedelta -from testgres import stop_all, clean_all import subprocess -from sys import exit class ValidateTest(ProbackupTest, unittest.TestCase):