Changeset 0f65ea9 in mod_gnutls for test/mgstest
- Timestamp:
- Jan 3, 2020, 5:05:34 AM (14 months ago)
- Branches:
- asyncio, master, proxy-ticket
- Children:
- 905063e
- Parents:
- 076049a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/mgstest/__init__.py
r076049a r0f65ea9 1 1 #!/usr/bin/python3 2 2 3 # Copyright 2019 Fiona Klute3 # Copyright 2019-2020 Fiona Klute 4 4 # 5 5 # Licensed under the Apache License, Version 2.0 (the "License"); … … 67 67 return m 68 68 return None 69 70 71 72 def require_match(regexp, file, error_message=None): 73 """Return the first match of the regular expression in file (by line), 74 or raise TestExpectationFailed. 75 76 If error_message is not None the exception message will be that 77 string, otherwise a generic message containing the regular 78 expression pattern. Technically applicable to any iterable 79 containing strings, not just files opened for reading. 80 81 """ 82 m = first_line_match(regexp, file) 83 if m: 84 return m 85 86 if error_message: 87 raise TestExpectationFailed(error_message) 88 else: 89 raise TestExpectationFailed(f'No match found for {regexp.pattern}!')
Note: See TracChangeset
for help on using the changeset viewer.