Download:
child 129:3a25896f01e1
parent 127:837ecaf010dc
128:a93fdb7416f0
Anton Shestakov <av6@dwimlabs.net>, Fri, 08 Jul 2016 00:15:17 +0800
tests: move database init/mocking to run-tests.py

2 файлов изменено, 11 вставок(+), 9 удалений(-) [+]
run-tests.py file | annotate | diff | comparison | revisions
tests/test_viewer.py file | annotate | diff | comparison | revisions
--- a/run-tests.py Fri Jul 08 00:11:51 2016 +0800
+++ b/run-tests.py Fri Jul 08 00:15:17 2016 +0800
@@ -2,9 +2,19 @@
import sys
import pytest
+from mock import Mock
+
+from candolint.models import database, Project, Change, Check
def main():
+ database.init(':memory:')
+ database.connect()
+ database.create_tables([Project, Change, Check], safe=True)
+ database.init = Mock()
+ database.connect = Mock()
+ database.close = Mock()
+
pytest.main(['tests'] + sys.argv[1:])
--- a/tests/test_viewer.py Fri Jul 08 00:11:51 2016 +0800
+++ b/tests/test_viewer.py Fri Jul 08 00:15:17 2016 +0800
@@ -1,21 +1,13 @@
-from mock import Mock
from pytest import raises
from tornado.web import HTTPError
from tornado.testing import AsyncHTTPTestCase
from candolint.handlers import get_project_or_404
-from candolint.models import database, Project, Change, Check
+from candolint.models import database, Project
from viewer import CandolintViewer
def setup_module():
- database.init(':memory:')
- database.connect()
- database.create_tables([Project, Change, Check], safe=True)
- database.init = Mock()
- database.connect = Mock()
- database.close = Mock()
-
with database.transaction():
Project.create(
url='https://example.com/alice/test-viewer',