Skip to main content

Pytest plugin to test the YLS as a whole.

Project description



Pytest plugin adding primitives for E2E/integration tests.

Public fixtures:

  • yls_prepare
  • yls_prepare_with_settings

To interact with the tested YLS use Context obtained by calling the fixture. For more information about the Context class checkout

Example test

# Add yls_prepare fixture
def test_completion_basic(yls_prepare):
    # Prepare the tested file
    # <$> marks the cursor position
    contents = """rule test {
    # Initialize the testing context by calling the fixture
    context = yls_prepare(contents)

    # You can now simulate requests on the context
    # In this case we trigger the code completion
    response = context.send_request(

    # Assert the response how you want
    assert response
    for module in ["cuckoo", "elf", "pe", "time"]:
        assert any(
            module in item["label"] for item in response["items"]
        ), f"{module=} is not in response"

For more inspiration check out yls/tests.


Copyright (c) 2022 Avast Software, licensed under the MIT license. See the LICENSE file for more details.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_yls-1.4.0.tar.gz (6.1 kB view hashes)

Uploaded source

Built Distribution

pytest_yls-1.4.0-py3-none-any.whl (8.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page