permit execution of tests with optimization set

- all tests except object tests now run with PYTHONOPTIMIZE=2
This commit is contained in:
The MMGen Project 2022-01-19 11:43:52 +00:00
commit b995cbf71e
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
4 changed files with 16 additions and 0 deletions

View file

@ -257,6 +257,11 @@ t_obj="
"
f_obj='Data object tests completed'
[ "$PYTHONOPTIMIZE" ] && {
echo -e "${YELLOW}PYTHONOPTIMIZE set, skipping object tests$RESET"
t_obj_skip='-'
}
i_color='Color'
s_color='Testing terminal colors'
t_color="- $colortest_py"

View file

@ -79,6 +79,11 @@ class TestSuiteHelp(TestSuiteBase):
'txsign','txdo','txbump'))
def tool_help(self):
if os.getenv('PYTHONOPTIMIZE') == '2':
ymsg('Skipping tool help with PYTHONOPTIMIZE=2 (no docstrings)')
return 'skip'
for args in (
['--help'],
['--longhelp'],

View file

@ -900,6 +900,9 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
return self._user_chk_label('alice',mmid,'Label added using coin address of MMGen address')
def alice_add_label_badaddr(self,addr,reply):
if os.getenv('PYTHONOPTIMIZE'):
omsg(yellow(f'PYTHONOPTIMIZE set, skipping test {self.test_name!r}'))
return 'skip'
t = self.spawn('mmgen-tool',['--alice','add_label',addr,'(none)'])
t.expect(reply,regex=True)
return t

View file

@ -75,6 +75,9 @@ class UnitTestHelpers(object):
@classmethod
def process_bad_data(cls,data):
if os.getenv('PYTHONOPTIMIZE'):
ymsg('PYTHONOPTIMIZE set, skipping error handling tests')
return
import re
desc_w = max(len(e[0]) for e in data)
exc_w = max(len(e[1]) for e in data)