Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ test: pythontest jstest
pythontest:
@echo "Running python testsuite"
@echo "------------------------"
python -m tornado.testing discover -s remoteappmanager -t . -v
python -m tornado.testing discover -s remoteappmanager -t .

.PHONY: jstest
jstest:
Expand Down
4 changes: 2 additions & 2 deletions remoteappmanager/cli/tests/test_remoteappdb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import unittest
from tornado.testing import LogTrapTestCase
from unittest import mock

from click.testing import CliRunner
Expand All @@ -14,7 +14,7 @@ def create_docker_client():
return VirtualDockerClient.with_containers()


class TestRemoteAppDbCLI(TempMixin, unittest.TestCase):
class TestRemoteAppDbCLI(TempMixin, LogTrapTestCase):
def setUp(self):
super().setUp()
self.db = os.path.join(self.tempdir, "test.db")
Expand Down
7 changes: 4 additions & 3 deletions remoteappmanager/db/tests/test_orm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import contextlib
import uuid
import os
import unittest

from tornado.testing import LogTrapTestCase

from remoteappmanager.db import orm
from remoteappmanager.db import exceptions
Expand Down Expand Up @@ -53,7 +54,7 @@ def fill_db(session):
session.add_all(accountings)


class TestOrm(TempMixin, unittest.TestCase):
class TestOrm(TempMixin, LogTrapTestCase):
def setUp(self):
super().setUp()
self.sqlite_file_path = os.path.join(self.tempdir, "sqlite.db")
Expand Down Expand Up @@ -139,7 +140,7 @@ def test_apps_for_user(self):


class TestOrmAppAccounting(TempMixin, ABCTestDatabaseInterface,
unittest.TestCase):
LogTrapTestCase):
def setUp(self):
# Setup temporary directory
super().setUp()
Expand Down
4 changes: 2 additions & 2 deletions remoteappmanager/docker/tests/test_container_manager.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from unittest import mock

from tornado.testing import AsyncTestCase, gen_test
from tornado.testing import AsyncTestCase, gen_test, LogTrapTestCase

from remoteappmanager.docker.container import Container
from remoteappmanager.docker.docker_labels import SIMPHONY_NS_RUNINFO
Expand All @@ -13,7 +13,7 @@
VirtualDockerClient)


class TestContainerManager(AsyncTestCase):
class TestContainerManager(AsyncTestCase, LogTrapTestCase):
def setUp(self):
super().setUp()
self.manager = ContainerManager(docker_config={}, realm="myrealm")
Expand Down
3 changes: 2 additions & 1 deletion remoteappmanager/handlers/admin/tests/test_admin_handlers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from tornado.testing import LogTrapTestCase
from remoteappmanager.tests import utils
from remoteappmanager.tests.mocking import dummy


class TestBaseAccess(utils.AsyncHTTPTestCase):
class TestBaseAccess(utils.AsyncHTTPTestCase, LogTrapTestCase):
#: which url to poke
url = "/user/johndoe"

Expand Down
3 changes: 2 additions & 1 deletion remoteappmanager/handlers/tests/test_base_handler.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from tornado.testing import LogTrapTestCase
from remoteappmanager.file_config import FileConfig

from remoteappmanager.tests import utils
from remoteappmanager.tests.mocking import dummy
from remoteappmanager.tests.temp_mixin import TempMixin


class TestBaseHandler(TempMixin, utils.AsyncHTTPTestCase):
class TestBaseHandler(TempMixin, utils.AsyncHTTPTestCase, LogTrapTestCase):
def get_file_config(self):
file_config = FileConfig()
file_config.accounting_class = \
Expand Down
4 changes: 3 additions & 1 deletion remoteappmanager/handlers/tests/test_home_handler.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from tornado.testing import LogTrapTestCase

from remoteappmanager.tests import utils
from remoteappmanager.tests.mocking import dummy
from remoteappmanager.tests.temp_mixin import TempMixin


class TestHomeHandler(TempMixin, utils.AsyncHTTPTestCase):
class TestHomeHandler(TempMixin, utils.AsyncHTTPTestCase, LogTrapTestCase):
def get_app(self):
app = dummy.create_application()
app.hub.verify_token.return_value = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from tornado.testing import LogTrapTestCase

from remoteappmanager.tests import utils
from remoteappmanager.tests.mocking import dummy
from remoteappmanager.tests.temp_mixin import TempMixin
from remoteappmanager.tests.utils import mock_coro_factory


class TestRegisterContainerHandler(TempMixin, utils.AsyncHTTPTestCase):
class TestRegisterContainerHandler(TempMixin,
utils.AsyncHTTPTestCase,
LogTrapTestCase):
def get_app(self):
app = dummy.create_application()
app.hub.verify_token.return_value = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import time
from tornado.testing import AsyncTestCase, gen_test
from tornado.testing import AsyncTestCase, gen_test, LogTrapTestCase

from remoteappmanager.tests.temp_mixin import TempMixin
from remoteappmanager.tests.utils import mock_coro_factory
Expand All @@ -11,7 +11,9 @@
from remoteappmanager.jupyterhub.auth import GitHubWhitelistAuthenticator


class TestGithubWhiteListAuthenticator(TempMixin, AsyncTestCase):
class TestGithubWhiteListAuthenticator(TempMixin,
AsyncTestCase,
LogTrapTestCase):
def setUp(self):
self.auth = GitHubWhitelistAuthenticator()
self.auth.authenticate = mock_coro_factory(return_value="foo")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from tornado.testing import AsyncTestCase, gen_test
from tornado.testing import AsyncTestCase, gen_test, LogTrapTestCase
from unittest.mock import Mock

from remoteappmanager.jupyterhub.auth import WorldAuthenticator


class TestWorldAuthenticator(AsyncTestCase):
class TestWorldAuthenticator(AsyncTestCase, LogTrapTestCase):
@gen_test
def test_basic_auth(self):
auth = WorldAuthenticator()
Expand Down
3 changes: 2 additions & 1 deletion remoteappmanager/jupyterhub/tests/test_spawners.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys
import time
from unittest import mock
from tornado.testing import LogTrapTestCase

from tornado import testing
from jupyterhub import orm
Expand Down Expand Up @@ -67,7 +68,7 @@ def new_spawner(spawner_class):
return spawner_class(db=db, user=user, hub=hub)


class TestSystemUserSpawner(TempMixin, testing.AsyncTestCase):
class TestSystemUserSpawner(TempMixin, testing.AsyncTestCase, LogTrapTestCase):
def setUp(self):
super().setUp()
self.spawner = new_spawner(SystemUserSpawner)
Expand Down
2 changes: 1 addition & 1 deletion remoteappmanager/services/tests/test_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get(self, url):
self.flush()


class TestHub(utils.AsyncHTTPTestCase):
class TestHub(utils.AsyncHTTPTestCase, testing.LogTrapTestCase):
def get_app(self):
self.handler = AuthHandler
handlers = [
Expand Down
2 changes: 1 addition & 1 deletion remoteappmanager/services/tests/test_reverse_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tornado import gen, testing


class TestReverseProxy(testing.AsyncTestCase):
class TestReverseProxy(testing.AsyncTestCase, testing.LogTrapTestCase):
@testing.gen_test
def test_reverse_proxy_operations(self):
coroutine_out = None
Expand Down
7 changes: 5 additions & 2 deletions remoteappmanager/tests/mocking/virtual/docker_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import logging
import hashlib
import uuid
import requests
Expand All @@ -11,6 +12,8 @@
SIMPHONY_NS_ENV,
SIMPHONY_NS_RUNINFO)

log = logging.getLogger(__name__)

# internal, convenience classes. Do not export (risks name collisions with
# container manager similarly named entities.

Expand Down Expand Up @@ -245,10 +248,10 @@ def port(self, container_name_or_id, private_port):
return None

def start(self, *args, **kwargs):
print("VirtualDockerClient.start called with ", args, kwargs)
log.info("VirtualDockerClient.start called with ", args, kwargs)

def stop(self, *args, **kwargs):
print("VirtualDockerClient.stop called with ", args, kwargs)
log.info("VirtualDockerClient.stop called with ", args, kwargs)

def remove_container(self, container, *args, **kwargs):
container = self._find_container(container)
Expand Down
4 changes: 3 additions & 1 deletion remoteappmanager/tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def __init__(self, *args, **kwargs):
pass


class TestApplication(TempMixin, testing.AsyncTestCase):
class TestApplication(TempMixin,
testing.AsyncTestCase,
testing.LogTrapTestCase):
def setUp(self):
super().setUp()

Expand Down
4 changes: 2 additions & 2 deletions remoteappmanager/tests/test_netutils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest import mock
from tornado import web
from tornado.testing import AsyncHTTPTestCase, gen_test
from tornado.testing import AsyncHTTPTestCase, gen_test, LogTrapTestCase

from remoteappmanager.tests.utils import mock_coro_new_callable
from remoteappmanager.netutils import wait_for_http_server_2xx
Expand All @@ -23,7 +23,7 @@ class LongHandler(ShortHandler):
error_count = 100000


class TestUtils(AsyncHTTPTestCase):
class TestUtils(AsyncHTTPTestCase, LogTrapTestCase):
def get_app(self):

app = web.Application(handlers=[('/short', ShortHandler),
Expand Down
4 changes: 2 additions & 2 deletions remoteappmanager/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import unittest
from tornado.testing import LogTrapTestCase
from remoteappmanager import utils


class TestUtils(unittest.TestCase):
class TestUtils(LogTrapTestCase):
def test_parse_volume_string(self):
self.assertEqual(utils.parse_volume_string("/foo:/bar:ro"),
("/foo", "/bar", "ro"))
Expand Down