debugpy/debugger_protocol/schema/file.py
Karthik Nadig 5f777818aa
Tests for break on start, wait for normal and abnormal exit (#952)
* Add variables and evaluate tests

* Add sort order and evaluate tests

* Ensure the last output is seen

* Add stop on entry tests, normal and abnormal exit tests

* Fix tests for 2.7

* Fix minor linting issue
2018-10-24 12:37:51 -07:00

15 lines
420 B
Python

class SchemaFileError(Exception):
"""A schema-file-related operation failed."""
def read_schema(filename, *, _open=open):
"""Return the data (bytes) in the given schema file."""
try:
schemafile = _open(filename, 'rb')
except FileNotFoundError:
raise SchemaFileError(
'schema file {!r} not found'.format(filename))
with schemafile:
return schemafile.read()