From 5fc4328b4f934111219559c26cfe00617ef2b2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E4=BF=8A=E5=A5=87?= Date: Fri, 26 May 2017 09:48:13 +0800 Subject: [PATCH] [SUPPORT] travis-ci --- .travis.yml | 6 ++++++ requirements.txt | 1 + test_poetry.py | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 .travis.yml create mode 100644 requirements.txt create mode 100644 test_poetry.py diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5927dbe --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: python +python: + - "2.7" +install: + - pip install -r requirements.txt +script: pytest diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7565aae --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pytest==3.1.0 diff --git a/test_poetry.py b/test_poetry.py new file mode 100644 index 0000000..aecdabf --- /dev/null +++ b/test_poetry.py @@ -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'))