1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
require("neotest").setup({
quickfix = {
open = false,
enabled = false,
},
status = {
enabled = true,
signs = true, -- Sign after function signature
virtual_text = false
},
icons = {
child_indent = "│",
child_prefix = "├",
collapsed = "─",
expanded = "╮",
failed = "✘",
final_child_indent = " ",
final_child_prefix = "╰",
non_collapsible = "─",
passed = "✓",
running = "",
running_animated = { "/", "|", "\\", "-", "/", "|", "\\", "-" },
skipped = "↓",
unknown = ""
},
floating = {
border = "rounded",
max_height = 0.9,
max_width = 0.9,
options = {}
},
summary = {
open = "botright vsplit | vertical resize 60"
},
highlights = {
adapter_name = "NeotestAdapterName",
border = "NeotestBorder",
dir = "NeotestDir",
expand_marker = "NeotestExpandMarker",
failed = "NeotestFailed",
file = "NeotestFile",
focused = "NeotestFocused",
indent = "NeotestIndent",
marked = "NeotestMarked",
namespace = "NeotestNamespace",
passed = "NeotestPassed",
running = "NeotestRunning",
select_win = "NeotestWinSelect",
skipped = "NeotestSkipped",
target = "NeotestTarget",
test = "NeotestTest",
unknown = "NeotestUnknown"
},
adapters = {
require("neotest-python")({
-- Extra arguments for nvim-dap configuration
-- See https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for values
dap = { justMyCode = false },
-- Command line arguments for runner
-- Can also be a function to return dynamic values
args = {"--log-level", "DEBUG"},
-- Runner to use. Will use pytest if available by default.
-- Can be a function to return dynamic value.
runner = "pytest",
-- Custom python path for the runner.
-- Can be a string or a list of strings.
-- Can also be a function to return dynamic value.
-- If not provided, the path will be inferred by checking for
-- virtual envs in the local directory and for Pipenev/Poetry configs
python = ".venv/bin/python",
-- Returns if a given file path is a test file.
-- NB: This function is called a lot so don't perform any heavy tasks within it.
})
},
})
require("neodev").setup({
library = { plugins = { "neotest" }, types = true },
...
})
vim.keymap.set("n", "tn", function()
require("neotest").run.run()
end)
vim.keymap.set("n", "tf", function()
require("neotest").run.run(vim.fn.expand("%"))
end)
vim.keymap.set("n", "tr", function()
local neotest = require("neotest")
neotest.run.run()
neotest.summary.open()
end,
{ noremap = true, silent = true, nowait = true })
vim.keymap.set("n", "ta", function()
local neotest = require("neotest")
neotest.run.attach()
end)
vim.keymap.set("n", "to", function()
local neotest = require("neotest")
neotest.output.open({ last_run = true, enter = true })
end,
{ noremap = true, silent = true, nowait = true })
vim.keymap.set("n", "tt", function()
local neotest = require("neotest")
neotest.summary.toggle()
end,
{ noremap = true, silent = true, nowait = true })
|