pytest-yls 1.4.4
pip install pytest-yls
Latest version
Released:
Pytest plugin to test the YLS as a whole.
Navigation
Unverified details
These details have not been verified by PyPIMeta
- License: MIT License (MIT)
- Author: Matej Kastak
- Maintainer: Matej Kašťák
- Requires: Python <4.0, >=3.8
Classifiers
- License
- Programming Language
Project description
pytest-yls
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
plugin.py.
Example test
# Add yls_prepare fixture
def test_completion_basic(yls_prepare):
# Prepare the tested file
# <$> marks the cursor position
contents = """rule test {
condition:
<$>
}"""
# 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(
methods.COMPLETION,
types.CompletionParams(
textDocument=types.TextDocumentIdentifier(uri=context.opened_file.as_uri()),
position=context.get_cursor_position(),
),
)
# 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.
License
Copyright (c) 2022 Avast Software, licensed under the MIT license. See the
LICENSE
file
for more details.
Project details
Unverified details
These details have not been verified by PyPIMeta
- License: MIT License (MIT)
- Author: Matej Kastak
- Maintainer: Matej Kašťák
- Requires: Python <4.0, >=3.8
Classifiers
- License
- Programming Language
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest_yls-1.4.4.tar.gz
.
File metadata
- Download URL: pytest_yls-1.4.4.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.2 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ede83ddbb38b4d70755d5b04f1c2a572911ab559e4692e10e3d48e2de0e2427 |
|
MD5 | e2dbe80f1585d8babaa10432ac2ed954 |
|
BLAKE2b-256 | baa9abf1f81b43114c59cdf5ef1109f51ad44a2d60fc7a18a2606e61575fc749 |
File details
Details for the file pytest_yls-1.4.4-py3-none-any.whl
.
File metadata
- Download URL: pytest_yls-1.4.4-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.2 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0300ceccfc97b2c7aa4a035b710c2abe805d082d0967320afa19ad5592c1ddf8 |
|
MD5 | 2436b0e7c9f669d26a74decbe4bc42e1 |
|
BLAKE2b-256 | 1e1bdab79ec19f0eb9b7782cd6d0f5572c894addd72d8ebf7132d0b84eec18ad |