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.2.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for lunar_test-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcafe23db48c00e071e261b2c465b6aaae3ed6b5dd9fc753c88a3ad00d6de19f |
|
MD5 | 7db00d6ab19fe6d342fd3318e26782a1 |
|
BLAKE2b-256 | 9bebd23bf325ea3a866d8134d2520bb6aaebe221dfee45328db40b56c703d878 |