Commit 95468654147288a386d1e073c7216291cfb552c3

Authored by Christian Herdtweck
1 parent d24210bc

tests: Do not assume we are running CPython

tests/msodde/test_crypto.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 import sys 3 import sys
4 import unittest 4 import unittest
5 -from os.path import join as pjoin 5 +from os.path import basename, join as pjoin
6 6
7 from tests.test_utils import DATA_BASE_DIR 7 from tests.test_utils import DATA_BASE_DIR
8 8
@@ -11,8 +11,8 @@ from oletools import msodde @@ -11,8 +11,8 @@ from oletools import msodde
11 11
12 12
13 @unittest.skipIf(not crypto.check_msoffcrypto(), 13 @unittest.skipIf(not crypto.check_msoffcrypto(),
14 - 'Module msoffcrypto not installed for python{}.{}'  
15 - .format(sys.version_info.major, sys.version_info.minor)) 14 + 'Module msoffcrypto not installed for {}'
  15 + .format(basename(sys.executable)))
16 class MsoddeCryptoTest(unittest.TestCase): 16 class MsoddeCryptoTest(unittest.TestCase):
17 """Test integration of decryption in msodde.""" 17 """Test integration of decryption in msodde."""
18 def test_standard_password(self): 18 def test_standard_password(self):
tests/olevba/test_crypto.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 import sys 3 import sys
4 import unittest 4 import unittest
5 -from os.path import join as pjoin 5 +from os.path import basename, join as pjoin
6 import json 6 import json
7 from collections import OrderedDict 7 from collections import OrderedDict
8 8
@@ -12,8 +12,8 @@ from oletools import crypto @@ -12,8 +12,8 @@ from oletools import crypto
12 12
13 13
14 @unittest.skipIf(not crypto.check_msoffcrypto(), 14 @unittest.skipIf(not crypto.check_msoffcrypto(),
15 - 'Module msoffcrypto not installed for python{}.{}'  
16 - .format(sys.version_info.major, sys.version_info.minor)) 15 + 'Module msoffcrypto not installed for {}'
  16 + .format(basename(sys.executable)))
17 class OlevbaCryptoWriteProtectTest(unittest.TestCase): 17 class OlevbaCryptoWriteProtectTest(unittest.TestCase):
18 """ 18 """
19 Test documents that are 'write-protected' through encryption. 19 Test documents that are 'write-protected' through encryption.