Skip to content
Merged
Changes from 3 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
6 changes: 6 additions & 0 deletions testgres/plugins/pg_probackup2/pg_probackup2/init_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ def __init__(self):
os.environ["PGAPPNAME"] = "pg_probackup"
self.delete_logs = delete_logs

if self.probackup_version.split('.')[0].isdigit:
Copy link
Contributor

Choose a reason for hiding this comment

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

Не .isdigit, а .isdigit(). .isdigit возвращает указатель на метод, который существует у любой строки, поэтому вернёт истинное значение для любой строки:

>>> if 'abc'.isdigit:
...   print('aaa')
... 
aaa

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Поправил, спасибо.

self.major_version = int(self.probackup_version.split('.')[0])
else:
print('Pg_probackup version is not correct!')
sys.exit(1)

Copy link
Contributor

Choose a reason for hiding this comment

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

Можно более безопасные преобразования сделат, на случай если в версии что-то не то будет.Либо не скастится в int либо не будет первого элемента

def test_env(self):
return self._test_env.copy()

Expand Down