pqc/test/test_api_h.py
Thom Wiggers 78a65d6ec9 Parallel tests (#206)
* Do tests with pytest to run them in parallel

* attempt to handle merge commits better for PR test path

Similar to how we solved this for travis

* Clean up imports

* don't run valgrind if not specified slow_test

* Fix functest after initializer rename

* upload tests results as junit

* Upload test-common files since #200 got merged

* Catch test results upload failure
2019-07-29 10:38:25 +02:00

34 rindas
732 B
Python

import os
import re
import pytest
import helpers
import pqclean
pattern = re.compile(r'^\s*#include\s*"')
@pytest.mark.parametrize(
'implementation',
pqclean.Scheme.all_implementations(),
ids=str,
)
@helpers.filtered_test
def test_api_h(implementation: pqclean.Implementation):
apipath = os.path.join(implementation.path(), 'api.h')
errors = []
with open(apipath) as f:
for i, line in enumerate(f):
if pattern.match(line):
errors.append("\n at {}:{}".format(apipath, i+1))
if errors:
raise AssertionError(
"Prohibited external include in api.h" + "".join(errors)
)
if __name__ == '__main__':
import sys
pytest.main(sys.argv)