Merge pull request #953 from willingc/covfix

Rename test class to stub class to allow pytest collection

Closes #952
This commit is contained in:
Carol Willing
2017-01-20 14:52:39 -08:00
committed by GitHub
4 changed files with 22 additions and 9 deletions

View File

@@ -1,4 +1,17 @@
[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 =
jupyterhub/tests/*
jupyterhub/alembic/*
*/site-packages/*

View File

@@ -14,7 +14,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:

View File

@@ -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

View File

@@ -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']