summaryrefslogtreecommitdiff
path: root/searx/testing.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2016-01-02 12:15:47 +0100
committerAdam Tauber <asciimoo@gmail.com>2016-01-10 19:23:10 +0100
commit39d2e0427f496e321a38e8a57b01a2c6043d2339 (patch)
tree4783f3af8f69a13a71598e8e57a96694310779f5 /searx/testing.py
parent3498b7c53fa73d627ff4f1b858f4dfd5008008f2 (diff)
downloadsearxng-39d2e0427f496e321a38e8a57b01a2c6043d2339.tar.gz
searxng-39d2e0427f496e321a38e8a57b01a2c6043d2339.zip
[fix] robot tests and pep8 check
Diffstat (limited to 'searx/testing.py')
-rw-r--r--searx/testing.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/searx/testing.py b/searx/testing.py
index e22ecf8fe..bc04d0fb0 100644
--- a/searx/testing.py
+++ b/searx/testing.py
@@ -3,6 +3,7 @@
from plone.testing import Layer
from unittest2 import TestCase
+from os.path import dirname, join, abspath
import os
@@ -42,11 +43,11 @@ class SearxRobotLayer(Layer):
os.path.abspath(os.path.dirname(os.path.realpath(__file__))),
'webapp.py'
)
- exe = os.path.abspath(os.path.dirname(__file__) + '/../bin/py')
+ exe = 'python'
# set robot settings path
- os.environ['SEARX_SETTINGS_PATH'] = os.path.abspath(
- os.path.dirname(__file__) + '/settings_robot.yml')
+ os.environ['SEARX_SETTINGS_PATH'] = abspath(
+ dirname(__file__) + '/settings_robot.yml')
# run the server
self.server = subprocess.Popen(
@@ -68,3 +69,16 @@ class SearxTestCase(TestCase):
"""Base test case for non-robot tests."""
layer = SearxTestLayer
+
+
+if __name__ == '__main__':
+ from tests.test_robot import test_suite
+ import sys
+ from zope.testrunner.runner import Runner
+
+ base_dir = abspath(join(dirname(__file__), '../tests'))
+ if sys.argv[1] == 'robot':
+ Runner(['--color',
+ '--auto-progress',
+ '--path', base_dir],
+ found_suites=[test_suite()]).run()