diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2023-12-08 17:30:19 +0100 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2023-12-08 18:16:24 +0100 |
commit | 4c65ac96f8b021c107783adce3e8afe4f8edee6e (patch) | |
tree | b951d272fe8d814ce0d67c610ad3e7f3a658b388 /test/functional/feature_notifications.py | |
parent | 37324ae3dfb0e50daaf752dc863a880559fa4637 (diff) | |
download | bitcoin-4c65ac96f8b021c107783adce3e8afe4f8edee6e.tar.xz |
test: detect OS consistently using `platform.system()`
Diffstat (limited to 'test/functional/feature_notifications.py')
-rwxr-xr-x | test/functional/feature_notifications.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/test/functional/feature_notifications.py b/test/functional/feature_notifications.py index adf6c13973..d2b5315d31 100755 --- a/test/functional/feature_notifications.py +++ b/test/functional/feature_notifications.py @@ -4,6 +4,7 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the -alertnotify, -blocknotify and -walletnotify options.""" import os +import platform from test_framework.address import ADDRESS_BCRT1_UNSPENDABLE from test_framework.descriptors import descsum_create @@ -14,13 +15,13 @@ from test_framework.util import ( # Linux allow all characters other than \x00 # Windows disallow control characters (0-31) and /\?%:|"<> -FILE_CHAR_START = 32 if os.name == 'nt' else 1 +FILE_CHAR_START = 32 if platform.system() == 'Windows' else 1 FILE_CHAR_END = 128 -FILE_CHARS_DISALLOWED = '/\\?%*:|"<>' if os.name == 'nt' else '/' +FILE_CHARS_DISALLOWED = '/\\?%*:|"<>' if platform.system() == 'Windows' else '/' UNCONFIRMED_HASH_STRING = 'unconfirmed' def notify_outputname(walletname, txid): - return txid if os.name == 'nt' else f'{walletname}_{txid}' + return txid if platform.system() == 'Windows' else f'{walletname}_{txid}' class NotificationsTest(BitcoinTestFramework): @@ -181,7 +182,7 @@ class NotificationsTest(BitcoinTestFramework): # Universal newline ensures '\n' on 'nt' assert_equal(text[-1], '\n') text = text[:-1] - if os.name == 'nt': + if platform.system() == 'Windows': # On Windows, echo as above will append a whitespace assert_equal(text[-1], ' ') text = text[:-1] |