Pytest 使用nodeid运行测试用例遇到问题

问题

Pytest 使用nodeid运行测试用例,代码如下

#test_a.py
import pytest

def test_one():
pass

class TestNode:
def test_one(self):
pass
@pytest.mark.parametrize(“x, y”, [(1,3), (3, 5)])
def test_two(self, x, y):
assert x+2 == y

我想指定某一个参数去运行比如:
pytest test_a.py::TestNode::test_two[1-3]

报错信息

zsh: no matches found: test_a.py::TestNode::test_two[1-3]

环境

zsh把你命令认成其他的命令了,可以试试 pytest 'test_a.py::TestNode::test_two[1-3]'

谢谢,确实是这个原因,已经解决了