From e117e7df6b9b67499f469c9ffad3072ac7c0e46e Mon Sep 17 00:00:00 2001 From: Chyroc Date: Fri, 24 Mar 2017 22:11:17 +0800 Subject: [PATCH] Add travis ci (#57) * add travis ci test --- .travis.yml | 22 +++++++++++++++ readme.md | 1 + requirements.txt | 10 +++---- test/TestOne.py | 10 +++++++ test/api_test.py | 57 --------------------------------------- test/code.jpg | Bin 2600 -> 0 bytes test/ruokuaicode_test.py | 18 ------------- 7 files changed, 38 insertions(+), 80 deletions(-) create mode 100644 .travis.yml create mode 100644 test/TestOne.py delete mode 100644 test/api_test.py delete mode 100644 test/code.jpg delete mode 100644 test/ruokuaicode_test.py diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..a403131 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +language: python + +python: +- 3.6 + +cache: + directories: + - $HOME/.cache/pip + +env: + global: + - PIP_WHEEL_DIR=$HOME/.cache/pip/wheels + - PIP_FIND_LINKS=file://$HOME/.cache/pip/wheels + +install: + - pip install -r requirements.txt + +before_script: + - export PYTHONPATH=$PYTHONPATH:$(pwd) + +script: + - python -m nose -vs \ No newline at end of file diff --git a/readme.md b/readme.md index d2cb41b..3b1134d 100644 --- a/readme.md +++ b/readme.md @@ -52,6 +52,7 @@ import logging.config logging.config.fileConfig('logging.conf') logger = logging.getLogger() + ## 引用 from wechatsogou import * diff --git a/requirements.txt b/requirements.txt index 1db56b6..4a86b1a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ -Flask==0.11.1 +Flask==0.12 lxml==3.7.0 -MarkupSafe==0.23 +MarkupSafe==1.0 nose==1.3.7 Pillow==3.4.2 -requests==2.10.0 +requests==2.13.0 six==1.10.0 -Werkzeug==0.11.11 +Werkzeug==0.12.1 xlrd==1.0.0 -zope.interface==4.3.2 +zope.interface==4.3.3 diff --git a/test/TestOne.py b/test/TestOne.py new file mode 100644 index 0000000..781b0c5 --- /dev/null +++ b/test/TestOne.py @@ -0,0 +1,10 @@ +import unittest + + +class TestOne(unittest.TestCase): + def test_for_fun(self): + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/api_test.py b/test/api_test.py deleted file mode 100644 index 25a0ff8..0000000 --- a/test/api_test.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -import unittest -from pprint import pprint - -import wechatsogou -from test import config - - -class ApiTest(unittest.TestCase): - def setUp(self): - ocr_config = { - 'type': 'ruokuai', - 'dama_name': config.username, - 'dama_pswd': config.password, - 'dama_soft_id': config.soft_id, - 'dama_soft_key': config.soft_key - } - self.api = wechatsogou.WechatSogouApi(ocr_config=ocr_config) - - def test_search_gzh_info(self): - name = '南京航空航天大学' - wechat_infos = self.api.search_gzh_info(name) - wechat_name = [wechat_info['name'] for wechat_info in wechat_infos] - assert name in wechat_name - - def test_get_gzh_info(self): - wechat_id = 'nanhangqinggong' - wechat_info = self.api.get_gzh_info(wechat_id) - assert '南航青年志愿者' == wechat_info['name'] - - def test_search_article_info(self): - keywords = '马达数据与虎嗅F&M节的亲密接触' - wechat_articles = self.api.search_article_info(keywords) - times = [wechat_article['article']['time'] for wechat_article in wechat_articles] - names = [wechat_article['gzh']['name'] for wechat_article in wechat_articles] - assert 1481244814 in times - assert '马达数据' in names - - def test_get_gzh_message(self): - data = self.api.get_gzh_message(wechatid='madadata') - assert len(data) > 2 - assert len(data[0]['title']) > 2 - - def test_get_gzh_message_and_info(self): - data_all = self.api.get_gzh_message_and_info(wechatid='madadata') - assert '北京马达加科技有限公司' == data_all['gzh_info']['authentication'] - assert len(data_all['gzh_messages']) > 2 - assert len(data_all['gzh_messages'][0]['title']) > 2 - - def test_get_recent_article_url_by_index_single(self): - articles_single = self.api.get_recent_article_url_by_index_single() - assert len(articles_single) == 20 - - -if __name__ == '__main__': - unittest.main() diff --git a/test/code.jpg b/test/code.jpg deleted file mode 100644 index dda164fcfa507274d9777cfb70e38d895f5be15b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 liter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