Skip to content

correctly test skips #568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions tests/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_pgpro434_2(self):

if self.get_version(node) < self.version_to_num('9.6.0'):
self.del_test_dir(module_name, fname)
return unittest.skip(
self.skipTest(
'Skipped because pg_control_checkpoint() is not supported in PG 9.5')

self.init_pb(backup_dir)
Expand Down Expand Up @@ -717,7 +717,7 @@ def test_replica_archive(self):

if self.get_version(master) < self.version_to_num('9.6.0'):
self.del_test_dir(module_name, fname)
return unittest.skip(
self.skipTest(
'Skipped because backup from replica is not supported in PG 9.5')

self.init_pb(backup_dir)
Expand Down Expand Up @@ -848,7 +848,7 @@ def test_master_and_replica_parallel_archiving(self):

if self.get_version(master) < self.version_to_num('9.6.0'):
self.del_test_dir(module_name, fname)
return unittest.skip(
self.skipTest(
'Skipped because backup from replica is not supported in PG 9.5')

replica = self.make_simple_node(
Expand Down Expand Up @@ -929,7 +929,7 @@ def test_basic_master_and_replica_concurrent_archiving(self):
make sure that archiving on both node is working.
"""
if self.pg_config_version < self.version_to_num('9.6.0'):
return unittest.skip('You need PostgreSQL >= 9.6 for this test')
self.skipTest('You need PostgreSQL >= 9.6 for this test')

fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
Expand All @@ -943,7 +943,7 @@ def test_basic_master_and_replica_concurrent_archiving(self):

if self.get_version(master) < self.version_to_num('9.6.0'):
self.del_test_dir(module_name, fname)
return unittest.skip(
self.skipTest(
'Skipped because backup from replica is not supported in PG 9.5')

replica = self.make_simple_node(
Expand Down Expand Up @@ -1035,7 +1035,7 @@ def test_concurrent_archiving(self):
"""

if self.pg_config_version < self.version_to_num('11.0'):
return unittest.skip('You need PostgreSQL >= 11 for this test')
self.skipTest('You need PostgreSQL >= 11 for this test')

fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
Expand Down Expand Up @@ -1196,7 +1196,7 @@ def test_archive_pg_receivexlog_compression_pg10(self):
self.add_instance(backup_dir, 'node', node)
node.slow_start()
if self.get_version(node) < self.version_to_num('10.0'):
return unittest.skip('You need PostgreSQL >= 10 for this test')
self.skipTest('You need PostgreSQL >= 10 for this test')
else:
pg_receivexlog_path = self.get_bin_path('pg_receivewal')

Expand Down Expand Up @@ -1278,7 +1278,7 @@ def test_archive_catalog(self):

if self.get_version(master) < self.version_to_num('9.6.0'):
self.del_test_dir(module_name, fname)
return unittest.skip(
self.skipTest(
'Skipped because backup from replica is not supported in PG 9.5')

self.init_pb(backup_dir)
Expand Down Expand Up @@ -1938,7 +1938,7 @@ def test_waldir_outside_pgdata_archiving(self):
check that archive-push works correct with symlinked waldir
"""
if self.pg_config_version < self.version_to_num('10.0'):
return unittest.skip(
self.skipTest(
'Skipped because waldir outside pgdata is supported since PG 10')

fname = self.id().split('.')[3]
Expand Down Expand Up @@ -2176,7 +2176,7 @@ def test_archive_pg_receivexlog_partial_handling(self):

if self.get_version(node) < self.version_to_num('9.6.0'):
self.del_test_dir(module_name, fname)
return unittest.skip(
self.skipTest(
'Skipped because backup from replica is not supported in PG 9.5')

self.init_pb(backup_dir)
Expand Down Expand Up @@ -2385,7 +2385,7 @@ def test_archive_get_batching_sanity(self):

if self.get_version(node) < self.version_to_num('9.6.0'):
self.del_test_dir(module_name, fname)
return unittest.skip(
self.skipTest(
'Skipped because backup from replica is not supported in PG 9.5')

self.init_pb(backup_dir)
Expand Down
8 changes: 4 additions & 4 deletions tests/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ def test_basic_temp_slot_for_stream_backup(self):
pg_options={'max_wal_size': '40MB'})

if self.get_version(node) < self.version_to_num('10.0'):
return unittest.skip('You need PostgreSQL >= 10 for this test')
self.skipTest('You need PostgreSQL >= 10 for this test')

self.init_pb(backup_dir)
self.add_instance(backup_dir, 'node', node)
Expand Down Expand Up @@ -1500,7 +1500,7 @@ def test_backup_concurrent_drop_table(self):
def test_pg_11_adjusted_wal_segment_size(self):
""""""
if self.pg_config_version < self.version_to_num('11.0'):
return unittest.skip('You need PostgreSQL >= 11 for this test')
self.skipTest('You need PostgreSQL >= 11 for this test')

fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
Expand Down Expand Up @@ -1743,7 +1743,7 @@ def test_drop_table(self):
def test_basic_missing_file_permissions(self):
""""""
if os.name == 'nt':
return unittest.skip('Skipped because it is POSIX only test')
self.skipTest('Skipped because it is POSIX only test')

fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
Expand Down Expand Up @@ -1790,7 +1790,7 @@ def test_basic_missing_file_permissions(self):
def test_basic_missing_dir_permissions(self):
""""""
if os.name == 'nt':
return unittest.skip('Skipped because it is POSIX only test')
self.skipTest('Skipped because it is POSIX only test')

fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
Expand Down
14 changes: 7 additions & 7 deletions tests/catchup.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def test_basic_ptrack_catchup(self):
Test ptrack catchup
"""
if not self.ptrack:
return unittest.skip('Skipped because ptrack support is disabled')
self.skipTest('Skipped because ptrack support is disabled')

# preparation 1: source
src_pg = self.make_simple_node(
Expand Down Expand Up @@ -336,7 +336,7 @@ def test_tli_ptrack_catchup(self):
Test that we correctly follow timeline change with ptrack catchup
"""
if not self.ptrack:
return unittest.skip('Skipped because ptrack support is disabled')
self.skipTest('Skipped because ptrack support is disabled')

# preparation 1: source
src_pg = self.make_simple_node(
Expand Down Expand Up @@ -475,7 +475,7 @@ def test_table_drop_with_ptrack(self):
Test that dropped table in source will be dropped in ptrack catchup'ed instance too
"""
if not self.ptrack:
return unittest.skip('Skipped because ptrack support is disabled')
self.skipTest('Skipped because ptrack support is disabled')

# preparation 1: source
src_pg = self.make_simple_node(
Expand Down Expand Up @@ -590,7 +590,7 @@ def test_tablefile_truncation_with_ptrack(self):
Test that truncated table in source will be truncated in ptrack catchup'ed instance too
"""
if not self.ptrack:
return unittest.skip('Skipped because ptrack support is disabled')
self.skipTest('Skipped because ptrack support is disabled')

# preparation 1: source
src_pg = self.make_simple_node(
Expand Down Expand Up @@ -655,7 +655,7 @@ def test_local_tablespace_without_mapping(self):
Test that we detect absence of needed --tablespace-mapping option
"""
if self.remote:
return unittest.skip('Skipped because this test tests local catchup error handling')
self.skipTest('Skipped because this test tests local catchup error handling')

src_pg = self.make_simple_node(base_dir = os.path.join(module_name, self.fname, 'src'))
src_pg.slow_start()
Expand Down Expand Up @@ -1035,7 +1035,7 @@ def test_unclean_ptrack_catchup(self):
Test that we correctly recover uncleanly shutdowned destination
"""
if not self.ptrack:
return unittest.skip('Skipped because ptrack support is disabled')
self.skipTest('Skipped because ptrack support is disabled')

# preparation 1: source
src_pg = self.make_simple_node(
Expand Down Expand Up @@ -1507,7 +1507,7 @@ def test_dry_run_catchup_ptrack(self):
Test dry-run option for catchup in incremental ptrack mode
"""
if not self.ptrack:
return unittest.skip('Skipped because ptrack support is disabled')
self.skipTest('Skipped because ptrack support is disabled')

# preparation 1: source
src_pg = self.make_simple_node(
Expand Down
2 changes: 1 addition & 1 deletion tests/compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def test_backward_compatibility_ptrack(self):
"""Description in jira issue PGPRO-434"""

if not self.ptrack:
return unittest.skip('Skipped because ptrack support is disabled')
self.skipTest('Skipped because ptrack support is disabled')

fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
Expand Down
2 changes: 1 addition & 1 deletion tests/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def test_delete_increment_page(self):
def test_delete_increment_ptrack(self):
"""delete increment and all after him"""
if not self.ptrack:
return unittest.skip('Skipped because ptrack support is disabled')
self.skipTest('Skipped because ptrack support is disabled')

fname = self.id().split('.')[3]
node = self.make_simple_node(
Expand Down
6 changes: 3 additions & 3 deletions tests/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ def test_external_dir_is_symlink(self):
but restored as directory
"""
if os.name == 'nt':
return unittest.skip('Skipped for Windows')
self.skipTest('Skipped for Windows')

fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
Expand Down Expand Up @@ -1618,7 +1618,7 @@ def test_external_dir_contain_symlink_on_dir(self):
but restored as directory
"""
if os.name == 'nt':
return unittest.skip('Skipped for Windows')
self.skipTest('Skipped for Windows')

fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
Expand Down Expand Up @@ -1703,7 +1703,7 @@ def test_external_dir_contain_symlink_on_file(self):
but restored as directory
"""
if os.name == 'nt':
return unittest.skip('Skipped for Windows')
self.skipTest('Skipped for Windows')

fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
Expand Down
2 changes: 1 addition & 1 deletion tests/false_positive.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_pg_10_waldir(self):
test group access for PG >= 11
"""
if self.pg_config_version < self.version_to_num('10.0'):
return unittest.skip('You need PostgreSQL >= 10 for this test')
self.skipTest('You need PostgreSQL >= 10 for this test')

fname = self.id().split('.')[3]
wal_dir = os.path.join(
Expand Down
9 changes: 8 additions & 1 deletion tests/helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
__all__ = ['ptrack_helpers', 'cfs_helpers', 'expected_errors']
#from . import *

import unittest

# python 2.7 compatibility
if not hasattr(unittest.TestCase, "skipTest"):
def skipTest(self, reason):
raise unittest.SkipTest(reason)
unittest.TestCase.skipTest = skipTest
4 changes: 2 additions & 2 deletions tests/incr_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ def test_make_replica_via_incr_checksum_restore(self):

if self.get_version(master) < self.version_to_num('9.6.0'):
self.del_test_dir(module_name, fname)
return unittest.skip(
self.skipTest(
'Skipped because backup from replica is not supported in PG 9.5')

self.init_pb(backup_dir)
Expand Down Expand Up @@ -1567,7 +1567,7 @@ def test_make_replica_via_incr_lsn_restore(self):

if self.get_version(master) < self.version_to_num('9.6.0'):
self.del_test_dir(module_name, fname)
return unittest.skip(
self.skipTest(
'Skipped because backup from replica is not supported in PG 9.5')

self.init_pb(backup_dir)
Expand Down
2 changes: 1 addition & 1 deletion tests/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ def test_merge_ptrack_truncate(self):
restore last page backup and check data correctness
"""
if not self.ptrack:
return unittest.skip('Skipped because ptrack support is disabled')
self.skipTest('Skipped because ptrack support is disabled')

fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
Expand Down
2 changes: 1 addition & 1 deletion tests/option.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,5 @@ def test_help_6(self):
help_out.read().decode("utf-8")
)
else:
return unittest.skip(
self.skipTest(
'You need configure PostgreSQL with --enabled-nls option for this test')
2 changes: 1 addition & 1 deletion tests/ptrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class PtrackTest(ProbackupTest, unittest.TestCase):
def setUp(self):
if self.pg_config_version < self.version_to_num('11.0'):
return unittest.skip('You need PostgreSQL >= 11 for this test')
self.skipTest('You need PostgreSQL >= 11 for this test')
self.fname = self.id().split('.')[3]

# @unittest.skip("skip")
Expand Down
Loading