-
Notifications
You must be signed in to change notification settings - Fork 0
Description
The fixtures for didOpen and others are found as constants in the test utils folder. Move these into actual pytest fixtures of the didOpen and respective tests. Ideally, the fixtures should be concrete fixture files, however creating an in-memory representation with modifications also works.
To create a pytest fixture that depends on one of the fixture file, see the following example.
@pytest.fixture
def in_memory_file(fixture_file_name: typing.BinaryIO):
buffer = io.BytesIO(fixture_file_name.readall())
buffer.write(/* modifications */)
return bufferIt is important to note that pytest will invoke this function seperately for each test that depends on the fixture and so they will all receive a unique buffer. If multiple tests are using the same value of the test, feel free to change the scope of the fixture (see pytest docs).
Since the fixtures for didOpen also modified the root conftest.py auto-importer of fixture files, this change should also be reverted.
Lastly, change the model DidOpenTextDocumentParams fields to have camel case names.
Reference diffs:
- feat: Did open text document notification #51
didOpenfixturesDidOpenTextDocumentParamsfield namesconftest.pymodifications for fixtures
- feat: didChange text document notification #53
didChangefixtures