Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
run: python -m generator --plugin testdata

- name: Rust Run Tests
run: cargo test --manifest-path tests/rust/Cargo.toml
run: cargo test --manifest-path pacakges/rust/lsprotocol/Cargo.toml
shell: bash
env:
LSP_TEST_DATA_PATH: ${{ github.workspace }}/packages/testdata
Expand Down
2 changes: 1 addition & 1 deletion generator/plugins/python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def customizations(spec: model.LSPModel) -> model.LSPModel:
return spec


def generate_from_spec(spec: model.LSPModel, output_dir: str, test_dir: str) -> None:
def generate_from_spec(spec: model.LSPModel, output_dir: str, _test_dir: str) -> None:
spec = customizations(spec)
code = TypesCodeGenerator(spec).get_code()

Expand Down
2 changes: 1 addition & 1 deletion generator/plugins/rust/rust_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def generate_from_spec(spec: model.LSPModel, output_dir: str, test_dir: str) ->
(output_path / file_name).write_text(code[file_name], encoding="utf-8")

# update tests if exists
test_path = pathlib.Path(test_dir) / "src" / "main.rs"
test_path = pathlib.Path(output_dir) / "src" / "test.rs"
if test_path.exists():
generate_test_code(spec, test_path)

Expand Down
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def tests(session: nox.Session):

session.log("Running tests: generator and generated Python code.")
session.run("pytest", "./tests")
session.run("pytest", "./packages/python/tests")


@nox.session()
Expand Down
2 changes: 1 addition & 1 deletion packages/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Issues = "https://github.com/microsoft/lsprotocol/issues"
Source = "https://github.com/microsoft/lsprotocol"

[tool.flit.sdist]
include = ["lsprotocol/", "README.md", "LICENSE"]
include = ["lsprotocol/", "tests/", "README.md", "LICENSE"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@T-256 Do you recommend including tests in the package? It will be incomplete as the generated test data, won't be part of it. It will get testing of special cases, if tests are run only with this package.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you recommend including tests in the package?

motivations here are same as other these python packages:
encode/httpx#2927
encode/httpcore#799

An usecase would be for package-indexing managers want to able test packages from sdist.

exclude = ["lsprotocol/__pycache__/", "requirements.in", "requirements.txt"]

[tool.mypy]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/rust/lsprotocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ keywords = ["lsp"]
proposed=[]

[dependencies]
glob = "0.3.1"
serde = {version ="1.0.152", features = ["derive"]}
serde_json = "1.0.93"
serde_repr = "0.1.10"
Expand Down
12 changes: 2 additions & 10 deletions tests/rust/src/main.rs → packages/rust/lsprotocol/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#[cfg(test)]
mod tests {
use glob::glob;
use lsprotocol::*;
use super::*;
use serde::Deserialize;
use std::fs;

Expand Down Expand Up @@ -355,7 +355,7 @@ mod tests {
println!("Running generated data tests");
let cwd = std::env::current_dir()
.unwrap()
.join("../../packages/testdata");
.join("../../../../generator/plugins/testdata");
let env_value = std::env::var("LSP_TEST_DATA_PATH")
.unwrap_or_else(|_| cwd.to_str().unwrap().to_string());
println!("TEST_DATA_ROOT: {}", env_value);
Expand All @@ -364,11 +364,3 @@ mod tests {
}
}
}

fn main() {
// Use data from test error report here to debug
// let json_data = "";

// Update the type here to debug
// serde_json::from_str::<lsprotocol::TextDocumentCompletionRequest>(json_data).unwrap();
}
17 changes: 0 additions & 17 deletions tests/rust/Cargo.toml

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion tests/generator/test_schema.py → tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import jsonschema

lsp_json_path = pathlib.Path(__file__).parent.parent.parent / "generator" / "lsp.json"
lsp_json_path = pathlib.Path(__file__).parent.parent / "generator" / "lsp.json"
lsp_schema_path = lsp_json_path.parent / "lsp.schema.json"


Expand Down