Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

34 строки
732 B

  1. import os
  2. import re
  3. import pytest
  4. import helpers
  5. import pqclean
  6. pattern = re.compile(r'^\s*#include\s*"')
  7. @pytest.mark.parametrize(
  8. 'implementation',
  9. pqclean.Scheme.all_implementations(),
  10. ids=str,
  11. )
  12. @helpers.filtered_test
  13. def test_api_h(implementation: pqclean.Implementation):
  14. apipath = os.path.join(implementation.path(), 'api.h')
  15. errors = []
  16. with open(apipath) as f:
  17. for i, line in enumerate(f):
  18. if pattern.match(line):
  19. errors.append("\n at {}:{}".format(apipath, i+1))
  20. if errors:
  21. raise AssertionError(
  22. "Prohibited external include in api.h" + "".join(errors)
  23. )
  24. if __name__ == '__main__':
  25. import sys
  26. pytest.main(sys.argv)