【问题标题】:Pycharm doesn't recognize file or folder with remote interpreterPycharm 无法识别文件或带有远程解释器的文件
【发布时间】:2022-10-04 19:51:36
【问题描述】:

在其唯一内容为的文件中

def test_sanity():
    pass

我正在尝试运行名为test_something.py 的文件。

文件夹结构是

uv_metadata
|---uv_metadata
|------tests
|----------test_something.py

得到错误

ssh://noam.s@ML:2202/home/noam.s/src/uv_metadata/venv/bin/python -u /home/noam.s/.pycharm_helpers/pycharm/_jb_pytest_runner.py --target test_something.py::test_sanity
Testing started at 14:34 ...
sh: 1: cd: can't cd to C:/Users/noam.s/src/uv_metadata/uv_metadata/tests
Launching pytest with arguments test_something.py::test_sanity --no-header --no-summary -q in /home/noam.s

============================= test session starts ==============================
collected 0 items                                                              

============================ no tests ran in 0.00s =============================
ERROR: file or directory not found: test_something.py::test_sanity


Process finished with exit code 4

Empty suite

我注意到sh: 1: cd: can't cd to C:/Users/noam.s/src/uv_metadata/uv_metadata/tests 这行没有意义。这是我的远程解释器的配置方式:

这只是停止工作,我不知道发生了什么变化。

如何让 Pycharm 再次识别测试文件夹?

【问题讨论】:

    标签: python pycharm pytest remote-debugging


    【解决方案1】:

    我隐约记得 PyCharm 有一个错误的部署屏幕,当某些映射在同一个解释器上单独配置时,这可能会导致冲突,有时甚至无法正常工作,即使来自不同的项目也是如此。

    很可能,我使用的是具有不同映射的同一个解释器,来自其他 Pycharm 实例。

    我必须去Build, Execution, Deployment -> Deployment 并从列表中删除所有内容。

    以下是一切都干净后的状态,我添加了一个新的解释器。

    我还清理了解释器列表

    它又开始工作了。

    【讨论】:

      猜你喜欢
      • 2023-01-30
      • 2021-11-05
      • 2012-07-26
      • 1970-01-01
      • 2019-02-19
      • 2022-01-12
      • 2021-07-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多