diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3d0b571 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +sudo: false +language: python +python: + - "3.4" + - "3.5" +install: pip install . +script: py.test \ No newline at end of file diff --git a/README.rst b/README.rst index 0ba3fb4..003b67b 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,7 @@ **nvchecker** (short for *new version checker*) is for checking if a new version of some software has been released. +[![Build Status](https://travis-ci.org/lilydjwg/nvchecker.svg)](https://travis-ci.org/lilydjwg/nvchecker) + Dependency ========== - Python 3 diff --git a/setup.py b/setup.py index a4c86c1..1802a66 100755 --- a/setup.py +++ b/setup.py @@ -9,6 +9,9 @@ setup( version = nvchecker.__version__, packages = find_packages(), install_requires = ['tornado', 'setuptools'], + tests_require=[ + 'pytest', + ], entry_points = { 'console_scripts': [ 'nvchecker = nvchecker.main:main', diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/helper.py b/tests/helper.py new file mode 100644 index 0000000..eb3c54e --- /dev/null +++ b/tests/helper.py @@ -0,0 +1,16 @@ +from nvchecker.get_version import get_version +import tornado.testing + + +class ExternalVersionTestCase(tornado.testing.AsyncTestCase): + def sync_get_version(self, name, config): + result = {} + + def get_version_callback(name, version): + result["version"] = version + self.stop() + + get_version(name, config, get_version_callback) + self.wait() + + return result["version"] diff --git a/tests/test_npm.py b/tests/test_npm.py new file mode 100644 index 0000000..60d9bfd --- /dev/null +++ b/tests/test_npm.py @@ -0,0 +1,6 @@ +from tests.helper import ExternalVersionTestCase + + +class NPMTest(ExternalVersionTestCase): + def test_npm(self): + self.assertEqual(self.sync_get_version("example", {"npm": None}), "0.0.0")