Changeset - d4e1692e25ab
[Not reviewed]
default
0 2 0
domruf - 10 years ago 2016-05-02 22:41:51
dominikruf@gmail.com
tests: introduce webserver fixture

To be used for tests that actually access a running web server - especially to
make the manual vcs tests less manual.
2 files changed with 17 insertions and 2 deletions:
0 comments (0 inline, 0 general)
dev_requirements.txt
Show inline comments
 
@@ -4,6 +4,7 @@ pytest ~= 3.0
 
pytest-runner
 
pytest-sugar>=0.7.0
 
pytest-catchlog
 
pytest-localserver
 
mock
 
sphinx
 
webtest < 3
kallithea/tests/conftest.py
Show inline comments
 
@@ -5,15 +5,17 @@ import pkg_resources
 

	
 
from paste.deploy import loadwsgi
 
from routes.util import URLGenerator
 
import pytest
 
from pytest_localserver.http import WSGIServer
 

	
 
import pytest
 
from kallithea.controllers.root import RootController
 
from kallithea.lib.utils import repo2db_mapper
 
from kallithea.model.user import UserModel
 
from kallithea.model.meta import Session
 
from kallithea.model.db import Setting, User, UserIpMap
 
from kallithea.model.scm import ScmModel
 
from kallithea.tests.base import invalidate_all_caches, TEST_USER_REGULAR_LOGIN, TESTS_TMP_PATH
 
from kallithea.tests.base import invalidate_all_caches, TEST_USER_REGULAR_LOGIN, TESTS_TMP_PATH, \
 
    TEST_USER_ADMIN_LOGIN, TEST_USER_ADMIN_PASS
 
import kallithea.tests.base # FIXME: needed for setting testapp instance!!!
 

	
 
from tg.util.webtest import test_context
 
@@ -142,3 +144,15 @@ def test_context_fixture(app_fixture):
 
    """
 
    with test_context(app_fixture):
 
        yield
 

	
 

	
 
@pytest.yield_fixture(scope="session")
 
def webserver():
 
    """Start web server while tests are running.
 
    Useful for debugging and necessary for vcs operation tests."""
 
    server = WSGIServer(application=kallithea.tests.base.testapp)
 
    server.start()
 

	
 
    yield server
 

	
 
    server.stop()
0 comments (0 inline, 0 general)