Skip to content

Commit 99aa82d

Browse files
committed
fix: correct discovering for RobotFramework 6.1a1
1 parent 814454a commit 99aa82d

File tree

984 files changed

+40517
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

984 files changed

+40517
-11
lines changed

hatch.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pre-install-commands = ["python ./scripts/install_packages.py"]
3030
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=robotcode --cov=tests {args}"
3131
no-cov = "cov --no-cov {args}"
3232
test = "pytest {args}"
33+
test-reset = "test --regtest-reset"
3334
install-bundled-editable = "python ./scripts/install_bundled_editable.py"
3435

3536
[envs.devel]
@@ -38,7 +39,7 @@ features = ["yaml", "rest", "lint", "tidy"]
3839

3940
[[envs.devel.matrix]]
4041
python = ["38", "39", "310", "311"]
41-
rf = ["rf41", "rf50", "rf60"]
42+
rf = ["rf41", "rf50", "rf60", "rf61a1"]
4243

4344
[envs.devel.overrides]
4445
matrix.rf.dependencies = [
@@ -51,10 +52,13 @@ matrix.rf.dependencies = [
5152
{ value = "robotframework>6.0.0, <6.1", if = [
5253
"rf60",
5354
] },
55+
{ value = "robotframework==6.1a1", if = [
56+
"rf61a1",
57+
] },
5458
]
5559

5660
[[envs.test.matrix]]
57-
rf = ["rf41", "rf50", "rf60"]
61+
rf = ["rf41", "rf50", "rf60", "rf61a1"]
5862

5963
[envs.test.overrides]
6064
matrix.rf.dependencies = [
@@ -67,6 +71,9 @@ matrix.rf.dependencies = [
6771
{ value = "robotframework>6.0.0, <6.1", if = [
6872
"rf60",
6973
] },
74+
{ value = "robotframework==6.1a1", if = [
75+
"rf61a1",
76+
] },
7077
]
7178

7279
[envs.lint]

packages/language_server/robotcode/language_server/robotframework/parts/discovering.py

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,21 @@
1313
from robotcode.core.logging import LoggingDescriptor
1414
from robotcode.core.uri import Uri
1515
from robotcode.jsonrpc2.protocol import rpc_method
16-
from robotcode.language_server.common.lsp_types import DocumentUri, Position, Range, TextDocumentIdentifier
16+
from robotcode.language_server.common.lsp_types import (
17+
DocumentUri,
18+
Position,
19+
Range,
20+
TextDocumentIdentifier,
21+
)
1722
from robotcode.language_server.robotframework.configuration import RobotConfig
1823
from robotcode.language_server.robotframework.utils.async_ast import AsyncVisitor
1924

2025
from .protocol_part import RobotLanguageServerProtocolPart
2126

2227
if TYPE_CHECKING:
23-
from robotcode.language_server.robotframework.protocol import RobotLanguageServerProtocol
28+
from robotcode.language_server.robotframework.protocol import (
29+
RobotLanguageServerProtocol,
30+
)
2431

2532

2633
@dataclass
@@ -107,7 +114,9 @@ def _patch(self) -> None:
107114
from robot.running import TestSuite
108115
from robot.running.builder.builders import RobotParser, TestSuiteBuilder
109116

110-
from robotcode.language_server.robotframework.utils.version import get_robot_version
117+
from robotcode.language_server.robotframework.utils.version import (
118+
get_robot_version,
119+
)
111120

112121
def get_document_text(source: str) -> str:
113122
check_canceled_sync()
@@ -138,7 +147,10 @@ def my_get_model_v4(source: str, data_only: bool = False, curdir: Optional[str]
138147
return File(source=source)
139148

140149
def my_get_model_v6(
141-
source: str, data_only: bool = False, curdir: Optional[str] = None, lang: Any = None
150+
source: str,
151+
data_only: bool = False,
152+
curdir: Optional[str] = None,
153+
lang: Any = None,
142154
) -> Any:
143155
check_canceled_sync()
144156
try:
@@ -193,7 +205,9 @@ async def get_tests_from_workspace(
193205
from robot.running import TestCase, TestSuite
194206
from robot.running.builder.builders import TestSuiteBuilder
195207

196-
from robotcode.language_server.robotframework.utils.version import get_robot_version
208+
from robotcode.language_server.robotframework.utils.version import (
209+
get_robot_version,
210+
)
197211

198212
async def generate(suite: TestSuite) -> TestItem:
199213
children: List[TestItem] = []
@@ -280,7 +294,7 @@ def nonexisting_paths(paths: List[str]) -> Iterator[str]:
280294

281295
valid_paths = list(normalize_paths(paths))
282296

283-
if get_robot_version() >= (6, 1):
297+
if get_robot_version() >= (6, 1, 0, "a", 2):
284298
builder = TestSuiteBuilder(
285299
included_suites=suites if suites else None,
286300
rpa=rpa_mode,
@@ -322,15 +336,19 @@ def nonexisting_paths(paths: List[str]) -> Iterator[str]:
322336
)
323337
]
324338

325-
if get_robot_version() >= (6, 1):
339+
if get_robot_version() >= (6, 1, 0, "a", 2):
326340
builder = TestSuiteBuilder(
327341
included_suites=suites if suites else None,
328342
rpa=rpa_mode,
329343
lang=languages,
330344
parsers=parsers,
331345
)
332346
elif get_robot_version() >= (6, 0):
333-
builder = TestSuiteBuilder(included_suites=suites if suites else None, rpa=rpa_mode, lang=languages)
347+
builder = TestSuiteBuilder(
348+
included_suites=suites if suites else None,
349+
rpa=rpa_mode,
350+
lang=languages,
351+
)
334352
else:
335353
builder = TestSuiteBuilder(included_suites=suites if suites else None, rpa=rpa_mode)
336354
return [await generate(builder.build(str(workspace_path)))]
@@ -359,7 +377,11 @@ def nonexisting_paths(paths: List[str]) -> Iterator[str]:
359377
@rpc_method(name="robot/discovering/getTestsFromDocument", param_type=GetTestsParams)
360378
@threaded()
361379
async def get_tests_from_document(
362-
self, text_document: TextDocumentIdentifier, base_name: Optional[str], *args: Any, **kwargs: Any
380+
self,
381+
text_document: TextDocumentIdentifier,
382+
base_name: Optional[str],
383+
*args: Any,
384+
**kwargs: Any,
363385
) -> List[TestItem]:
364386
try:
365387
return await FindTestCasesVisitor().get(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
data: !GeneratedTestData
2+
character: 16
3+
line: 1
4+
name: built-in library
5+
result:
6+
- !CodeAction
7+
command:
8+
arguments:
9+
- <removed>
10+
command: robotcode.showDocumentation
11+
title: Open Documentation
12+
data: null
13+
diagnostics: null
14+
disabled: null
15+
edit: null
16+
is_preferred: null
17+
kind: source.openDocumentation
18+
title: Open Documentation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
data: !GeneratedTestData
2+
character: 21
3+
line: 1
4+
name: built-in library
5+
result:
6+
- !CodeAction
7+
command:
8+
arguments:
9+
- <removed>
10+
command: robotcode.showDocumentation
11+
title: Open Documentation
12+
data: null
13+
diagnostics: null
14+
disabled: null
15+
edit: null
16+
is_preferred: null
17+
kind: source.openDocumentation
18+
title: Open Documentation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
data: !GeneratedTestData
2+
character: 26
3+
line: 1
4+
name: built-in library
5+
result:
6+
- !CodeAction
7+
command:
8+
arguments:
9+
- <removed>
10+
command: robotcode.showDocumentation
11+
title: Open Documentation
12+
data: null
13+
diagnostics: null
14+
disabled: null
15+
edit: null
16+
is_preferred: null
17+
kind: source.openDocumentation
18+
title: Open Documentation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
data: !GeneratedTestData
2+
character: 16
3+
line: 3
4+
name: user library
5+
result:
6+
- !CodeAction
7+
command:
8+
arguments:
9+
- <removed>
10+
command: robotcode.showDocumentation
11+
title: Open Documentation
12+
data: null
13+
diagnostics: null
14+
disabled: null
15+
edit: null
16+
is_preferred: null
17+
kind: source.openDocumentation
18+
title: Open Documentation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
data: !GeneratedTestData
2+
character: 21
3+
line: 3
4+
name: user library
5+
result:
6+
- !CodeAction
7+
command:
8+
arguments:
9+
- <removed>
10+
command: robotcode.showDocumentation
11+
title: Open Documentation
12+
data: null
13+
diagnostics: null
14+
disabled: null
15+
edit: null
16+
is_preferred: null
17+
kind: source.openDocumentation
18+
title: Open Documentation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
data: !GeneratedTestData
2+
character: 26
3+
line: 3
4+
name: user library
5+
result:
6+
- !CodeAction
7+
command:
8+
arguments:
9+
- <removed>
10+
command: robotcode.showDocumentation
11+
title: Open Documentation
12+
data: null
13+
diagnostics: null
14+
disabled: null
15+
edit: null
16+
is_preferred: null
17+
kind: source.openDocumentation
18+
title: Open Documentation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
data: !GeneratedTestData
2+
character: 16
3+
line: 5
4+
name: user library by path with variable
5+
result:
6+
- !CodeAction
7+
command:
8+
arguments:
9+
- <removed>
10+
command: robotcode.showDocumentation
11+
title: Open Documentation
12+
data: null
13+
diagnostics: null
14+
disabled: null
15+
edit: null
16+
is_preferred: null
17+
kind: source.openDocumentation
18+
title: Open Documentation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
data: !GeneratedTestData
2+
character: 31
3+
line: 5
4+
name: user library by path with variable
5+
result:
6+
- !CodeAction
7+
command:
8+
arguments:
9+
- <removed>
10+
command: robotcode.showDocumentation
11+
title: Open Documentation
12+
data: null
13+
diagnostics: null
14+
disabled: null
15+
edit: null
16+
is_preferred: null
17+
kind: source.openDocumentation
18+
title: Open Documentation

0 commit comments

Comments
 (0)