pqc/test/test_format.py
Thom Wiggers ff186b3dd6
Run AStyle if it is installed
Also try to install it on AppVeyor
2019-03-06 17:15:24 +01:00

33 lines
804 B
Python

import shutil
import unittest
import pqclean
from helpers import run_subprocess
def test_formatting():
for scheme in pqclean.Scheme.all_schemes():
for implementation in scheme.implementations:
yield check_format, implementation
def check_format(implementation: pqclean.Implementation):
if shutil.which('astyle') is None:
raise unittest.SkipTest("AStyle is not installed")
cfiles = implementation.cfiles()
hfiles = implementation.hfiles()
run_subprocess(['astyle',
'--dry-run',
'--options=../.astylerc',
*cfiles,
*hfiles])
if __name__ == "__main__":
try:
import nose2
nose2.main()
except ImportError:
import nose
nose.runmodule()