From c086f05c7c7f5271833f8322269b0122337926ad Mon Sep 17 00:00:00 2001 From: Carol Willing Date: Fri, 20 Jan 2017 10:44:46 -0800 Subject: [PATCH 1/6] Rename test class to allow pytest to collect tests --- jupyterhub/tests/mocking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyterhub/tests/mocking.py b/jupyterhub/tests/mocking.py index 0dabff23..69b21c8d 100644 --- a/jupyterhub/tests/mocking.py +++ b/jupyterhub/tests/mocking.py @@ -234,7 +234,7 @@ class MockSingleUserServer(SingleUserNotebookApp): pass -class TestSingleUserSpawner(MockSpawner): +class StubSingleUserSpawner(MockSpawner): """Spawner that starts a MockSingleUserServer in a thread.""" _thread = None @gen.coroutine From 5df16371e1af6826a3077ece877e4af2bbd5d7e7 Mon Sep 17 00:00:00 2001 From: Carol Willing Date: Fri, 20 Jan 2017 10:48:51 -0800 Subject: [PATCH 2/6] Rename class used in test cases to StubSingleUserSpawner --- jupyterhub/tests/test_singleuser.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/jupyterhub/tests/test_singleuser.py b/jupyterhub/tests/test_singleuser.py index a3054d3d..cede2e70 100644 --- a/jupyterhub/tests/test_singleuser.py +++ b/jupyterhub/tests/test_singleuser.py @@ -6,14 +6,14 @@ import sys import requests import jupyterhub -from .mocking import TestSingleUserSpawner, public_url +from .mocking import StubSingleUserSpawner, public_url from ..utils import url_path_join def test_singleuser_auth(app, io_loop): - # use TestSingleUserSpawner to launch a single-user app in a thread - app.spawner_class = TestSingleUserSpawner - app.tornado_settings['spawner_class'] = TestSingleUserSpawner + # use StubSingleUserSpawner to launch a single-user app in a thread + app.spawner_class = StubSingleUserSpawner + app.tornado_settings['spawner_class'] = StubSingleUserSpawner # login, start the server cookies = app.login_user('nandy') @@ -39,9 +39,9 @@ def test_singleuser_auth(app, io_loop): def test_disable_user_config(app, io_loop): - # use TestSingleUserSpawner to launch a single-user app in a thread - app.spawner_class = TestSingleUserSpawner - app.tornado_settings['spawner_class'] = TestSingleUserSpawner + # use StubSingleUserSpawner to launch a single-user app in a thread + app.spawner_class = StubSingleUserSpawner + app.tornado_settings['spawner_class'] = StubSingleUserSpawner # login, start the server cookies = app.login_user('nandy') user = app.users['nandy'] From 5b43266278e33e200cd69a567952b0399642480e Mon Sep 17 00:00:00 2001 From: Carol Willing Date: Fri, 20 Jan 2017 11:26:19 -0800 Subject: [PATCH 3/6] Update coverage setting to ignore test directory --- .coveragerc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.coveragerc b/.coveragerc index 891ddfca..97c3e920 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,4 +1,15 @@ [run] +branch = False omit = jupyterhub/tests/* jupyterhub/alembic/* + +[report] +exclude_lines = + if self.debug: + pragma: no cover + raise NotImplementedError + if __name__ == .__main__.: +ignore_errors = True +omit = + tests/* From a43069fc35dffb82137bd76285c037a4a3e74bde Mon Sep 17 00:00:00 2001 From: Carol Willing Date: Fri, 20 Jan 2017 11:35:39 -0800 Subject: [PATCH 4/6] Correct syntax in coverage command --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ee21e75b..da240264 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ before_install: install: - pip install --pre -f travis-wheels/wheelhouse -r dev-requirements.txt . script: - - travis_retry py.test --cov jupyterhub jupyterhub/tests -v + - travis_retry py.test --cov=jupyterhub jupyterhub/tests -v after_success: - codecov matrix: From 4afb659f44b84d495619cac6c63fb0c61f94bf2c Mon Sep 17 00:00:00 2001 From: Carol Willing Date: Fri, 20 Jan 2017 12:25:33 -0800 Subject: [PATCH 5/6] Omit travis site-packages directory from report --- .coveragerc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.coveragerc b/.coveragerc index 97c3e920..0e0ca457 100644 --- a/.coveragerc +++ b/.coveragerc @@ -12,4 +12,5 @@ exclude_lines = if __name__ == .__main__.: ignore_errors = True omit = - tests/* + jupyterhub/tests/* + */site-packages/* From 246f0bc44218491232da26bd2bc763e54d0c844d Mon Sep 17 00:00:00 2001 From: Carol Willing Date: Fri, 20 Jan 2017 12:30:46 -0800 Subject: [PATCH 6/6] Omit alembic directory from report --- .coveragerc | 1 + 1 file changed, 1 insertion(+) diff --git a/.coveragerc b/.coveragerc index 0e0ca457..bdafbdb0 100644 --- a/.coveragerc +++ b/.coveragerc @@ -13,4 +13,5 @@ exclude_lines = ignore_errors = True omit = jupyterhub/tests/* + jupyterhub/alembic/* */site-packages/*