Skip to content

Add checking enable-nls option in configure #501

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 3 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 14 additions & 0 deletions tests/helpers/ptrack_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ def is_enterprise():
else:
return False

def enable_nls():
Copy link
Contributor

@avaness avaness Jun 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename to check_enable_nls() or something like this

cmd = [os.environ['PG_CONFIG'], '--configure']

p = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
if b'enable-nls' in p.communicate()[0]:
return True
else:
return False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not

Suggested change
if b'enable-nls' in p.communicate()[0]:
return True
else:
return False
return b'enable-nls' in p.communicate()[0]

?



class ProbackupException(Exception):
def __init__(self, message, cmd):
Expand Down Expand Up @@ -147,6 +160,7 @@ def slow_start(self, replica=False):
class ProbackupTest(object):
# Class attributes
enterprise = is_enterprise()
enable_nls = enable_nls()

def __init__(self, *args, **kwargs):
super(ProbackupTest, self).__init__(*args, **kwargs)
Expand Down
16 changes: 10 additions & 6 deletions tests/option.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,13 @@ def test_options_5(self):
# @unittest.skip("skip")
def test_help_6(self):
"""help options"""
self.test_env['LC_ALL'] = 'ru_RU.utf-8'
with open(os.path.join(self.dir_path, "expected/option_help_ru.out"), "rb") as help_out:
self.assertEqual(
self.run_pb(["--help"]),
help_out.read().decode("utf-8")
)
if ProbackupTest.enable_nls:
self.test_env['LC_ALL'] = 'ru_RU.utf-8'
with open(os.path.join(self.dir_path, "expected/option_help_ru.out"), "rb") as help_out:
self.assertEqual(
self.run_pb(["--help"]),
help_out.read().decode("utf-8")
)
else:
return unittest.skip(
'You need configure PostgreSQL with --enabled-nls option for this test')