Python与Teamcity的单位测试
我喜欢在Teamcity Build期间进行单位测试。我在构建中配置了此步骤,就像pytest一样,使用参数测试/单位/*。py。在此运行期间,我对我实际测试的模块有“ ModulenotFoundError”。因此,我的猜测是树结构或工作目录正在改变。 因此,我的工作树看起来像这样:
pipeline ---> __init__.py (empty file)
pipiline ---> model.py
在此文件内部,我有此定义
class Model():
夹以下内容:
test ---> unit ---> test_model.py
内部test_model。
from model import Model
test
ModuleNotFoundError: No module named 'model'
文件 如何在Python中做到这一点。
I like to run unit-tests during Teamcity build. I configure this step in the build like pytest with arguments test/unit/*.py. During this run I have "ModuleNotFoundError" for a module that I am actually testing. So my guess is that somehow the tree structure or working directory is changing.
So my working tree looks like that:
pipeline ---> __init__.py (empty file)
pipiline ---> model.py
inside this file I have this definition
class Model():
The test folders are following:
test ---> unit ---> test_model.py
inside test_model.py I have:
from model import Model
During the run I have
ModuleNotFoundError: No module named 'model'
I guess I should somehow define the Model class like dll, but I do not understand how to do this in Python.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论