forked from Ponysearch/Ponysearch
[fix] robot tests and pep8 check
This commit is contained in:
parent
3498b7c53f
commit
39d2e0427f
3 changed files with 20 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,6 +5,7 @@ env
|
|||
robot_log.html
|
||||
robot_output.xml
|
||||
robot_report.html
|
||||
test_basic/
|
||||
setup.cfg
|
||||
|
||||
*.pyc
|
||||
|
|
|
@ -15,7 +15,7 @@ update_dev_packages() {
|
|||
|
||||
pep8_check() {
|
||||
echo '[!] Running pep8 check'
|
||||
pep8 "$SEARX_DIR" "$BASE_DIR/tests"
|
||||
pep8 --max-line-length=120 "$SEARX_DIR" "$BASE_DIR/tests"
|
||||
}
|
||||
|
||||
unit_tests() {
|
||||
|
@ -32,8 +32,7 @@ py_test_coverage() {
|
|||
|
||||
robot_tests() {
|
||||
echo '[!] Running robot tests'
|
||||
python -c "import zope.testrunner; import sys; sys.exit(zope.testrunner.run("\
|
||||
"['--color', '--auto-progress', '--layer', 'SearxRobotLayer', '--test-path', '$BASE_DIR']))"
|
||||
PYTHONPATH=`pwd` python "$SEARX_DIR/testing.py" robot
|
||||
}
|
||||
|
||||
tests() {
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue