Commit b8ba847bd09c84ce6973eca1ffce7c2dfb0516da

Authored by Christian Herdtweck
1 parent f899797d

tests: speed up longest test

On my test VM this reduces test time for this one test from 33s to
10s
Showing 1 changed file with 6 additions and 2 deletions
tests/olevba/test_basic.py
@@ -76,14 +76,14 @@ class TestOlevbaBasic(unittest.TestCase): @@ -76,14 +76,14 @@ class TestOlevbaBasic(unittest.TestCase):
76 76
77 def test_crypt_return(self): 77 def test_crypt_return(self):
78 """ 78 """
79 - Tests that encrypted files give a certain return code. 79 + Test that encrypted files give a certain return code.
80 80
81 Currently, only the encryption applied by Office 2010 (CryptoApi RC4 81 Currently, only the encryption applied by Office 2010 (CryptoApi RC4
82 Encryption) is tested. 82 Encryption) is tested.
83 """ 83 """
84 CRYPT_DIR = join(DATA_BASE_DIR, 'encrypted') 84 CRYPT_DIR = join(DATA_BASE_DIR, 'encrypted')
85 CRYPT_RETURN_CODE = 9 85 CRYPT_RETURN_CODE = 9
86 - ADD_ARGS = [], ['-d', ], ['-a', ], ['-j', ], ['-t', ] 86 + ADD_ARGS = [], ['-d', ], ['-a', ], ['-j', ], ['-t', ] # only 1st file
87 EXCEPTIONS = ['autostart-encrypt-standardpassword.xls', # These ... 87 EXCEPTIONS = ['autostart-encrypt-standardpassword.xls', # These ...
88 'autostart-encrypt-standardpassword.xlsm', # files ... 88 'autostart-encrypt-standardpassword.xlsm', # files ...
89 'autostart-encrypt-standardpassword.xlsb', # are ... 89 'autostart-encrypt-standardpassword.xlsb', # are ...
@@ -103,6 +103,10 @@ class TestOlevbaBasic(unittest.TestCase): @@ -103,6 +103,10 @@ class TestOlevbaBasic(unittest.TestCase):
103 msg='Wrong return code {} for args {}'\ 103 msg='Wrong return code {} for args {}'\
104 .format(ret_code, args + [filename, ])) 104 .format(ret_code, args + [filename, ]))
105 105
  106 + # test only first file with all arg combinations, others just
  107 + # without arg (test takes too long otherwise
  108 + ADD_ARGS = ([], )
  109 +
106 110
107 # just in case somebody calls this file as a script 111 # just in case somebody calls this file as a script
108 if __name__ == '__main__': 112 if __name__ == '__main__':