mirror of
https://kkgithub.com/chinese-poetry/chinese-poetry.git
synced 2026-04-12 10:07:19 +00:00
[SUPPORT] travis-ci
This commit is contained in:
6
.travis.yml
Normal file
6
.travis.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
language: python
|
||||||
|
python:
|
||||||
|
- "2.7"
|
||||||
|
install:
|
||||||
|
- pip install -r requirements.txt
|
||||||
|
script: pytest
|
||||||
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
pytest==3.1.0
|
||||||
21
test_poetry.py
Normal file
21
test_poetry.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#! -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
|
||||||
|
测试古诗JSON文件是否有效
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os, json
|
||||||
|
|
||||||
|
def check_json(json):
|
||||||
|
filepath = os.path.join('./json', json)
|
||||||
|
with open(filepath) as file:
|
||||||
|
try:
|
||||||
|
_ = json.loads(file.read())
|
||||||
|
return True
|
||||||
|
except:
|
||||||
|
assert False, "校验(%s)失败" % json
|
||||||
|
|
||||||
|
|
||||||
|
def test_json():
|
||||||
|
map(check_json, os.listdir('./json'))
|
||||||
Reference in New Issue
Block a user