diff options
author | Matej Cotman <cotman.matej@gmail.com> | 2014-01-19 22:59:01 +0100 |
---|---|---|
committer | Matej Cotman <cotman.matej@gmail.com> | 2014-01-20 01:06:29 +0100 |
commit | dd4662978dd74c0dce089790689fe0a8a4f9bb16 (patch) | |
tree | f10d4c2cff38a66c01fe763ee666361ec6975581 /searx/testing.py | |
parent | b7fa79081f3c7c9ce2974c406e07b1e48cb9534a (diff) | |
download | searxng-dd4662978dd74c0dce089790689fe0a8a4f9bb16.tar.gz searxng-dd4662978dd74c0dce089790689fe0a8a4f9bb16.zip |
fix: robot fw, entry points, some flake8, package searx egg
Diffstat (limited to 'searx/testing.py')
-rw-r--r-- | searx/testing.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/searx/testing.py b/searx/testing.py index 4b1810d6a..51c44d826 100644 --- a/searx/testing.py +++ b/searx/testing.py @@ -7,10 +7,10 @@ from unittest2 import TestCase import os import subprocess -import sys class SearxTestLayer: + """Base layer for non-robot tests.""" __name__ = u'SearxTestLayer' @@ -36,24 +36,37 @@ class SearxRobotLayer(Layer): def setUp(self): os.setpgrp() # create new process group, become its leader + + # get program paths webapp = os.path.join( os.path.abspath(os.path.dirname(os.path.realpath(__file__))), 'webapp.py' ) exe = os.path.abspath(os.path.dirname(__file__) + '/../bin/py') + + # set robot settings path + os.environ['SEARX_SETTINGS_PATH'] = os.path.abspath( + os.path.dirname(__file__) + '/settings_robot.yml') + + # run the server self.server = subprocess.Popen( - [exe, webapp, 'settings_robot'], + [exe, webapp], stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) def tearDown(self): - # TERM all processes in my group + # send TERM signal to all processes in my group, to stop subprocesses os.killpg(os.getpgid(self.server.pid), 15) + # remove previously set environment variable + del os.environ['SEARX_SETTINGS_PATH'] + SEARXROBOTLAYER = SearxRobotLayer() class SearxTestCase(TestCase): + """Base test case for non-robot tests.""" + layer = SearxTestLayer |