From 069fe649da48f356d80f9a4a412220614d548732 Mon Sep 17 00:00:00 2001 From: Ilya Kulakov Date: Wed, 29 Aug 2018 12:30:43 -0700 Subject: [PATCH 1/3] Enable the test command. Tests can be run via: - python setup.py test - python -m unittest test - pytest - pytest test --- setup.cfg | 4 ++++ test/__init__.py | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/setup.cfg b/setup.cfg index 7d46951..c3f7605 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,3 +33,7 @@ keywords = packages = find: python_requires = >=3.4 zip_safe = True +test_suite = test.test_suite + +[tool:pytest] +testpaths = test diff --git a/test/__init__.py b/test/__init__.py index a0c86f3..a568263 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1,4 +1,13 @@ -from .test_case import * -from .test_helpers import * -from .test_mock import * -from .test_selector import * +import unittest + +test_modules = ( + 'test_case', + 'test_helpers', + 'test_mock', + 'test_selector' +) +test_suite = unittest.defaultTestLoader.loadTestsFromNames(('{}.{}'.format(__name__, m) for m in test_modules)) + + +def load_tests(loader, tests, pattern): + return test_suite From 793342e2f7ea7bafb2f16ecf4694bf9c4fe5f851 Mon Sep 17 00:00:00 2001 From: Ilya Kulakov Date: Wed, 29 Aug 2018 12:32:21 -0700 Subject: [PATCH 2/3] Use the test command to run tests on CI. --- .appveyor.yml | 2 +- .travis.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 48ef287..f4c5949 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -32,4 +32,4 @@ install: build: off test_script: - - "%PYTHON%\\python.exe -m unittest test" + - "%PYTHON%\\python.exe setup.py test" diff --git a/.travis.yml b/.travis.yml index 4bc3653..f4f638a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -148,8 +148,8 @@ install: - python -m pip install --upgrade wheel>=0.30.0 setuptools>=36.6.0 script: -- python -m unittest --verbose test -- "[[ $(python -c \"import platform; print(platform.python_implementation())\") == \"CPython\" ]] && PYTHONASYNCIODEBUG=1 python -m unittest test || true" +- python setup.py test +- "[[ $(python -c \"import platform; print(platform.python_implementation())\") == \"CPython\" ]] && PYTHONASYNCIODEBUG=1 python setup.py test || true" deploy: provider: pypi From f962c4f5ecce2adc5d115ea26858680de2201775 Mon Sep 17 00:00:00 2001 From: Ilya Kulakov Date: Wed, 29 Aug 2018 12:42:08 -0700 Subject: [PATCH 3/3] Itegrate with coveralls. Fixes #69 --- .appveyor.yml | 6 +++++- .travis.yml | 6 +++++- README.rst | 3 +++ setup.cfg | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index f4c5949..99b180c 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -27,9 +27,13 @@ environment: install: - "%PYTHON%\\python.exe -m pip install --upgrade pip" - - "%PYTHON%\\python.exe -m pip install --upgrade wheel>=0.30.0 setuptools>=36.6.0" + - "%PYTHON%\\python.exe -m pip install --upgrade wheel>=0.30.0 setuptools>=36.6.0 coveralls>=1.5.0" build: off test_script: - "%PYTHON%\\python.exe setup.py test" + +after_test: + - "%PYTHON%\\python.exe -m coverage run setup.py test" + - "%PYTHON%\\python.exe -m coveralls" diff --git a/.travis.yml b/.travis.yml index f4f638a..cd0d3d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -145,12 +145,16 @@ matrix: install: - curl https://bootstrap.pypa.io/get-pip.py | python -- python -m pip install --upgrade wheel>=0.30.0 setuptools>=36.6.0 +- python -m pip install --upgrade wheel>=0.30.0 setuptools>=36.6.0 coveralls>=1.5.0 script: - python setup.py test - "[[ $(python -c \"import platform; print(platform.python_implementation())\") == \"CPython\" ]] && PYTHONASYNCIODEBUG=1 python setup.py test || true" +after_success: +- python -m coverage run setup.py test +- python -m coveralls + deploy: provider: pypi user: martius diff --git a/README.rst b/README.rst index 23a8a9a..caad1c7 100644 --- a/README.rst +++ b/README.rst @@ -7,6 +7,9 @@ .. image:: https://ci.appveyor.com/api/projects/status/github/Martiusweb/asynctest?branch=master&svg=true :target: https://ci.appveyor.com/project/Martiusweb/asynctest/branch/master :alt: AppVeyor +.. image:: https://coveralls.io/repos/github/Martiusweb/asynctest/badge.svg?branch=master + :target: https://coveralls.io/github/Martiusweb/asynctest?branch=master + :alt: Coverage .. image:: https://img.shields.io/pypi/pyversions/asynctest.svg :target: https://github.com/Martiusweb/asynctest :alt: Supported Python versions diff --git a/setup.cfg b/setup.cfg index c3f7605..beff20f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,5 +35,9 @@ python_requires = >=3.4 zip_safe = True test_suite = test.test_suite +[coverage:run] +branch = True +source = asynctest + [tool:pytest] testpaths = test