如何将 NestedValueError类和 validate_item函数从模块导入 test.py ?
我应该使用 conftest.py 作为模块和测试文件之间的中介吗?
# /modules/errors.py
class EmptyValueError(Exception):
pass
#/modules/validate_item.py
def validate_item():
pass
#/tests/test.py
import pytest
def test_item_validate_exception_nested_value():
with pytest.raises(EmptyValueError):
validate_item({})