neotest-python 项目使用教程

neotest-python 项目使用教程

neotest-python项目地址:https://gitcode.com/gh_mirrors/ne/neotest-python

1. 项目的目录结构及介绍

neotest-python 项目的目录结构如下:

neotest-python/
├── lua/
│   └── neotest-python/
│       └── neotest_python.lua
├── scripts/
├── .gitignore
├── LICENSE.md
├── README.md
├── neotest.py
├── pyproject.toml
├── stylua.toml

目录结构介绍

  • lua/neotest-python/: 包含 neotest-python 的核心 Lua 脚本文件。
  • scripts/: 包含项目的辅助脚本。
  • .gitignore: 指定 Git 版本控制系统忽略的文件和目录。
  • LICENSE.md: 项目的许可证文件。
  • README.md: 项目的说明文档。
  • neotest.py: 项目的 Python 脚本文件。
  • pyproject.toml: 项目的配置文件,用于定义项目依赖和构建工具。
  • stylua.toml: 用于配置 Lua 代码格式化的工具。

2. 项目的启动文件介绍

项目的启动文件是 lua/neotest-python/neotest_python.lua。这个文件是 neotest-python 插件的核心,负责配置和启动 neotest 适配器。

启动文件内容概述

  • 初始化 neotest 适配器:

    require("neotest").setup({
      adapters = {
        require("neotest-python")
      }
    })
    
  • 可选配置项:

    require("neotest").setup({
      adapters = {
        require("neotest-python")({
          -- Extra arguments for nvim-dap configuration
          dap = {
            justMyCode = false
          },
          -- Command line arguments for runner
          args = ["--log-level", "DEBUG"],
          -- Runner to use
          runner = "pytest",
          -- Custom python path for the runner
          python = "venv/bin/python"
        })
      }
    })
    

3. 项目的配置文件介绍

项目的配置文件主要包括 pyproject.tomlstylua.toml

pyproject.toml

pyproject.toml 文件用于定义项目的依赖和构建工具。以下是一个示例:

[tool.poetry]
name = "neotest-python"
version = "0.1.0"
description = "Neotest adapter for python"
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = "^3.8"
pytest = "^6.2"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

stylua.toml

stylua.toml 文件用于配置 Lua 代码格式化的工具。以下是一个示例:

column_width = 80
indent_width = 2
quote_style = "single"

通过这些配置文件,可以确保项目的依赖管理、构建过程和代码格式化的一致性。

neotest-python项目地址:https://gitcode.com/gh_mirrors/ne/neotest-python

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

惠进钰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值