Closed GLMeece closed 2 months ago
I use the Python method pathlib.Path.resolve
in some places to get a normalized file name. Depending on how the command line parameters are, I sometimes have absolute paths or relative paths, which can also contain things like ..
, under Windows even the upper/lower case is irrelevant. But since VSCode internally only works with URI's and these can only be absolute paths and are also case sensitive when comparing, I need a way to make sure that a filename I supply to VSCode is absolute and normalized.
Unfortunately, the python method pathlib.Path.resolve
has the habit of resolving symbolic links. And you can't turn it off.
In os.path
there is also no real way to do this without the symbolic link resolution.
Maybe someone knows an algorithm, function or something else in Python that can do this?
Otherwise I'll have to write one myself.
But problem recognized, I know what to do, but maybe it takes a litte time...
Tests discovered - repo name is 'doubled'
In contrast to RFLS, RobotCode uses RobotFramework algorithms to recognize which suites/test cases/tasks are in the project. Therefore, the test case structure in RobotCode looks and behaves exactly the same as in RobotFramework execution/reports or logs. You can even use --include --exclude or PreRunModifier if you define them in the (attention spoiler) robot.toml
.
And with RobotCode you can open several RobotFramework projects/folders in the same workspace, all of which have completely different Python interpreters, RobotFramework versions etc..
Therefore the top node is the folder/project name, the second node is not duplicated, but the suite name of RobotFramework. You can also customize the name of the suite via command line, (spoiler) robot.toml
file, or also with name
in *** Settings ***
, but also define paths where RobotCode should search for test cases, this corresponds to the call robot folder1 folder2
.
Summary
RobotCode ignores a mapped drive's pathing and instead uses a full UNC pathing, resulting in a test suite file not being located properly.
Detail
If you have your repo on a mapped network drive (in my case, via VMware's Shared Folders), although your tests are "discovered", when you click on the
Go to Test (Alt+Enter)
icon, instead of using the Windows mapping (e.g.,e:\Repos\windows-qa-automation
) it attempts to use the full UNC pathing (e.g./Shared folders/Repos/windows-qa-automation/tests/MYSUITENAMEHERE.robot
).Because Windows can't find it, it asks the user if they want to create it.
Additionally, in opening up the suite, the test cases are formatted/discovered properly, but you cannot execute the test cases by clicking on a 'run' arrow.
Prerequisites
C:\Users\myuser\Repos
net use e: "\\vmware-host\Shared Folders"
* FWIW, In the author's case, it is a Windows 11 Virtual Machine running under VMware Workstation Pro 17.5
Steps to Reproduce
Scenario 1 - code.exe CLI
Note: The author will provide other scenarios as time permits; simply trying to describe the initial scenario here.
.\code.exe tunnel
(if you've not authorized this tunnel before, you'll need to do so via GitHub)Go to Test (Alt+Enter)
iconIssue: VS Code/RobotCode attempts to open the file as a UNC path vs. a file on a mapped drive. The result is that the test cannot be executed.
Screenshots
Tests discovered - repo name is 'doubled'
Robocorp LSP Example:
Video Screen Captures
Note: GIF "videos" are more easily seen if opened in new tab.
Robocorp's LSP Under Scenario 1
Robotcode Under Scenario 1
Expected Behavior
Using Robocorp's LSP, the tests are discovered, you are able to go to the file/test case in question, execute and debug the test.
I would expect the same behavior with RobotCode.
VS Code Output Logs
RobotCode
RobotCode Language Server
none
Environment
1.86.1
v0.74.0
Windows 11 Enterprise
3.10.11
6.0
robotframework-robocop
=4.2.1