欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > python >内容正文

python

(一) 关于配置travis-ci持续集成python pytest测试的相关记录

发布时间:2025/7/25 python 82 豆豆
生活随笔 收集整理的这篇文章主要介绍了 (一) 关于配置travis-ci持续集成python pytest测试的相关记录 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

首先由于公司用上了高大上的travis-ci商用版,一直想试着学学弄弄看。现在要写openapi的相关测试,而且要在travis-ci上集成。我就想体验一下这个过程。所以自己弄了一个public的仓库先尝试一下。

 

首先了解travis-ci的相关比较重要。https://docs.travis-ci.com/user/customizing-the-build/

这里首先介绍了需要集成测试的语言指定方面的问题。travis-ci的所有配置都集中在一个叫做 .travis.yml 的文件下面。这个文件告诉travis-ci

  • What programming language your project uses
  • What commands or scripts you want to be executed before each build (for example, to install or clone your project’s dependencies)
  • What command is used to run your test suite
  • Emails, Campfire and IRC rooms to notify about build failures

所以可以看出,相关的自定义处理都在这个文件里面进行写入。下面我继续翻译一下文档。

创建travis-ci一般由两步构成:

1. 安装:安装依赖和需求

2. 脚本:运行编写的脚本文件

你可以执行自定义命令在安装之前before_install或者在运行脚本之前before_script或者在运行脚本之后after_script.

在before_install里,你可以安装一些额外的需求比如说ubuntu包和一些自定义的服务。

下面太简单懒得翻了直接贴

You can perform additional steps when your build succeeds or fails using the after_success (such as building documentation, or deploying to a custom server) or after_failure (such as uploading log files) options. In both after_failure and after_success, you can access the build result using the $TRAVIS_TEST_RESULT environment variable.

The complete build lifecycle, including three optional deployment steps and after checking out the git repository and changing to the repository directory, is:

  • before_install
  • install
  • before_script
  • script
  • after_success or after_failure
  • OPTIONAL before_deploy
  • OPTIONAL deploy
  • OPTIONAL after_deploy
  • after_script
  • 如果步需要第一步安装的话 可以直接设置 install: true

     

    转载于:https://www.cnblogs.com/piperck/p/5111849.html

    总结

    以上是生活随笔为你收集整理的(一) 关于配置travis-ci持续集成python pytest测试的相关记录的全部内容,希望文章能够帮你解决所遇到的问题。

    如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。