【问题标题】:How to use pytest correctly如何正确使用pytest
【发布时间】:2020-10-11 19:48:57
【问题描述】:

我正在构建我的第一个 python 包。 我注意到 pytest 对直接进入 GitHub 的代码进行了自动测试 我搜索了良好而清晰的解释,但我无法弄清楚自己 有什么办法可以帮助我吗?

目录结构:

-> deezepy:
       |
       -> __init__.py
       -> client.py
       -> types.py

-> tests/
       currently empty

我应该在我的测试目录中放什么?两个文件:

client.py -> https://hastebin.com/yoyemirula.py

types.py -> https://hastebin.com/amafegilic.rb

我很高兴有人能帮助我第一次使用这些工具,谢谢!

【问题讨论】:

标签: python testing github continuous-integration pytest


【解决方案1】:

如果您希望 pytest 在每次 git push 上运行,您应该考虑使用 GitHub Action,例如:Python Pytest GitHub Action

关注Rupert Thomas 中的“Automate Python Testing With GitHub Actions”以获得更手动的示例(他不使用该操作,但明确说明了在您的代码上运行 pytest 所需的所有步骤)。

【讨论】:

    猜你喜欢
    • 2014-11-07
    • 1970-01-01
    • 1970-01-01
    • 2019-12-12
    • 2017-03-12
    • 1970-01-01
    • 1970-01-01
    • 2022-08-16
    • 2020-03-24
    相关资源
    最近更新 更多