nvim-neotest / nvim-neotest/neotest-python

Path containing forward slash won't be splited on Windows when matching the file

Open
#107 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
192
Forks
60
PR merge metrics
No merged PRs in 30d

Description

I'm on Windows, and the following problem doesn't occur on Ubuntu(wsl)

When I run tests in test_add.py or toggle tests summary, it shows that no tests found.

I've looked through the source code and modified base.lua in neotest-python

Image

Then I run tests again and got the following output:

Image

It seems that the adapter splits the file path by \, but my file path contains only /

Then I modified the source code, changing this line

local elems = vim.split(file_path, Path.path.sep)

into

local elems = vim.split(file_path, "/")

Then tests summary shows all the tests correctly.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in base.lua at the path-splitting logic using Path.path.sep, and compare it with the path format reported on Windows. Reproduce the issue with test_add.py or the tests summary, then verify that files using forward slashes are matched and their tests are discovered correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim, python
Domain
testing, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.