From 346385ed516780c942a2fad99f47f6fe82314a25 Mon Sep 17 00:00:00 2001 From: Yuri Prezument Date: Fri, 15 Jan 2016 10:27:41 +0200 Subject: [PATCH 1/7] Add .travis.yml, test against multiply Python versions --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..a4d0022e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: python +python: + - "3.2" + - "3.3" + - "3.4" + - "3.5" +install: + - pip install -r requirements.txt +script: + - python tests/unit_tests.py From 0a8db7dbcdd97db380107d3cc00e13f750f2c4ee Mon Sep 17 00:00:00 2001 From: Yuri Prezument Date: Fri, 15 Jan 2016 11:09:17 +0200 Subject: [PATCH 2/7] Add travis.ci badge to the readme --- README.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.rst b/README.rst index 87309793..5452c9c2 100644 --- a/README.rst +++ b/README.rst @@ -5,6 +5,11 @@ Newspaper3k: Article scraping & curation :target: http://badge.fury.io/py/newspaper3k.svg :alt: Latest version +.. image:: https://secure.travis-ci.org/codelucas/newspaper.png + :target: http://travis-ci.org/codelucas/newspaper/ + :alt: Build status + + Inspired by `requests`_ for its simplicity and powered by `lxml`_ for its speed: "Newspaper is an amazing python library for extracting & curating articles." From 7b0ae544f50ec859b62b15fec562ef6def1be8a2 Mon Sep 17 00:00:00 2001 From: Yuri Prezument Date: Fri, 15 Jan 2016 11:33:23 +0200 Subject: [PATCH 3/7] unit_test - exit with status code This way CI tools / test runners can know if the tests passed or failed --- tests/unit_tests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit_tests.py b/tests/unit_tests.py index 61c1e923..c26794e9 100644 --- a/tests/unit_tests.py +++ b/tests/unit_tests.py @@ -519,7 +519,9 @@ def test_spanish_fulltext_extract(self): suite.addTest(UrlTestCase()) suite.addTest(ArticleTestCase()) suite.addTest(APITestCase()) - unittest.TextTestRunner().run(suite) + result = unittest.TextTestRunner().run(suite) + exit_code = 0 if result.wasSuccessful() else 1 + sys.exit(exit_code) # TODO: suite.addTest(SourceTestCase()) # suite.addTest(MThreadingTestCase()) From 24675e9c44a6c13ce159e34b800c9b60fdd5ffb9 Mon Sep 17 00:00:00 2001 From: Yuri Prezument Date: Fri, 15 Jan 2016 11:39:16 +0200 Subject: [PATCH 4/7] travis.yml - download nltk corpora before running tests --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a4d0022e..1dc89bf0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,5 +6,6 @@ python: - "3.5" install: - pip install -r requirements.txt + - python -c "import nltk ; nltk.download('punkt')" script: - python tests/unit_tests.py From d4073f1b9d1e4f4ae746494a0aa416f05052c070 Mon Sep 17 00:00:00 2001 From: Yuri Prezument Date: Fri, 15 Jan 2016 11:43:54 +0200 Subject: [PATCH 5/7] Disable Python3.5 support (for now) --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1dc89bf0..571f4f4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ python: - "3.2" - "3.3" - "3.4" - - "3.5" install: - pip install -r requirements.txt - python -c "import nltk ; nltk.download('punkt')" From 5af033376b110cb497ee8045494ee8e3bb72d375 Mon Sep 17 00:00:00 2001 From: Yuri Prezument Date: Fri, 15 Jan 2016 20:17:27 +0200 Subject: [PATCH 6/7] Reuse download_corpora.py in Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 571f4f4e..ee37c324 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,6 @@ python: - "3.4" install: - pip install -r requirements.txt - - python -c "import nltk ; nltk.download('punkt')" + - python download_corpora.py script: - python tests/unit_tests.py From ea631dfbf44bf969786b79c7ea2d0fabb1b17694 Mon Sep 17 00:00:00 2001 From: Yuri Prezument Date: Thu, 21 Jan 2016 12:00:04 +0200 Subject: [PATCH 7/7] Travis badge - switch to svg --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 5452c9c2..7e1ed6d7 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ Newspaper3k: Article scraping & curation :target: http://badge.fury.io/py/newspaper3k.svg :alt: Latest version -.. image:: https://secure.travis-ci.org/codelucas/newspaper.png +.. image:: https://travis-ci.org/codelucas/newspaper.svg :target: http://travis-ci.org/codelucas/newspaper/ :alt: Build status