lunar_test
Project description
【lunar-Ci】今日诸事不宜!
你是否有过这样的经历,明明合并代码之前通过了所有测试,但是上线之后服务就炸了?
这是因为你的测试不够全面。在Librian幼女娱乐中心(这是个公司),合并代码之前得先检查黄历,如果黄历说诸事不宜,那就不能合并。
使用方法
你只需要为你的GitHub仓库新建一个Action,设置为在收到PR的时候进行单元测试就可以了。
之后所有的PR提交的时候,就会自动对黄历进行测试,从而阻止仓库维护者在诸事不宜的那天合并代码。
Action的参考代码长这样——
name: CI
on:
push:
branches: [ slave ]
pull_request:
branches: [ slave ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2.2.2
with:
python-version: 3.9
- name: Install dependencies
run: pip install lunar_test
- name: lunar_test
run: python -m unittest lunar_test
对了,虽然这是一个Python仓库,但这个Action和仓库语言没有关系,大家都可以用。
本地测试
你也可以使用lunar_test来测试你的本地代码,也只要先pip install lunar_test
,然后在测试脚本里加上——
python -m unittest lunar_test
这样就好了,测试代码从来没有这么方便!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lunar_test-0.0.5.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for lunar_test-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a8a4ad71c7f4bd2052a764bc20127d02932f01e63aa526e0a05c9d1b799bdeb |
|
MD5 | 9f804f9a079d5889f32ffc878f2aff12 |
|
BLAKE2b-256 | ca0df1f91ef1d507488d88c44af7c259e97d4d4b2eff8c0b801af9b85bd25738 |