From 11f34379ec6a2969f7e580584c98e5da91756365 Mon Sep 17 00:00:00 2001 From: Micah Cochran Date: Sat, 27 Aug 2016 17:09:53 -0500 Subject: [PATCH] Add Travis testing. --- .travis.yml | 13 +++++++++++-- shapefile.py | 11 +++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index ab4803a..8ad2cdd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,17 @@ language: python + python: -- '2.7' + - '2.7' + - '3.3' + - '3.4' + - '3.5' + +install: + - pip install . + script: -- touch foo + - python shapefile.py + deploy: provider: pypi user: jlawhead diff --git a/shapefile.py b/shapefile.py index f63d9c8..0e1f4a2 100644 --- a/shapefile.py +++ b/shapefile.py @@ -1190,11 +1190,13 @@ def __fieldNorm(self, fieldName): fieldName.replace(' ', '_') # Begin Testing -def test(): +def test(**kwargs): import doctest doctest.NORMALIZE_WHITESPACE = 1 - doctest.testfile("README.md", verbose=1) - + verbosity = kwargs.get('verbose', 1) + failure_count, test_count = doctest.testfile("README.md", verbose=verbosity) + return failure_count + if __name__ == "__main__": """ Doctests are contained in the file 'README.md'. This library was originally developed @@ -1202,4 +1204,5 @@ def test(): testing libraries but for now unit testing is done using what's available in 2.3. """ - test() + failure_count = test() + sys.exit(failure_count)