From 1f00f435b79565c37b1c158ff353dded45571d8d Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Sep 05 2017 06:55:45 +0000 Subject: Merge #27 `Add tox to run tests` --- diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..755c7cf --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include LICENSE.txt README.md +include requirements.txt test-requirements.txt +include tox.ini diff --git a/libpagure/__init__.py b/libpagure/__init__.py index 9bac352..5e28967 100644 --- a/libpagure/__init__.py +++ b/libpagure/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -from .libpagure import * +from .libpagure import * # noqa diff --git a/libpagure/libpagure.py b/libpagure/libpagure.py index de26e6e..c1c9a47 100644 --- a/libpagure/libpagure.py +++ b/libpagure/libpagure.py @@ -11,6 +11,7 @@ class NullHandler(logging.Handler): def emit(self, record): pass + LOG = logging.getLogger("libpagure") # Add the null handler to top-level logger used by the library @@ -329,12 +330,14 @@ class Pagure(object): :param tags: filers the tags of the issues :param assignee: filters the assignee of the issues :param author: filters the author of the issues - :param milestones: filters the milestones of the issues (list of strings) + :param milestones: filters the milestones of the issues (list of + strings) :param priority: filters the priority of the issues :param no_stones: If True returns only the issues having no milestone, if False returns only the issues having a milestone :param since: Filters the issues updated after this date. - The date can either be provided as an unix date or in the format Y-M-D + The date can either be provided as an unix date or in the format + Y-M-D :return: """ if self.username is None: diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..663bd1f --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +requests \ No newline at end of file diff --git a/setup.py b/setup.py index 853d09f..f03166f 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,16 @@ except ImportError: from distutils.core import setup +def get_install_requires(): + with open('requirements.txt', 'r') as f: + return [line.strip() for line in f] + + +def get_test_requires(): + with open('test-requirements.txt', 'r') as f: + return [line.strip() for line in f if not line.startswith('-r ')] + + setup( name='libpagure', packages=['libpagure'], @@ -30,5 +40,6 @@ setup( ], license='GNU General Public License v2.0', - install_requires=['requests'], + install_requires=get_install_requires(), + test_requires=get_test_requires(), ) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..83c4fd0 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,7 @@ +-r requirements.txt + +flake8 +mock +pytest +pytest-cov +tox \ No newline at end of file diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..4c1a7e6 --- /dev/null +++ b/tox.ini @@ -0,0 +1,15 @@ +[tox] +envlist = py26,py27,py34,py35,py36,flake8 + +[testenv] +deps = -r{toxinidir}/test-requirements.txt +whitelist_externals = + flake8 + pytest +commands = + # Remove comment when first test is added + # py.test --cov {envsitepackagesdir}/libpagure {posargs} + +[testenv:flake8] +deps = flake8 >= 2.5.5 +commands = flake8 libpagure/