mirror of https://github.com/scrapy/scrapy.git
sorted out running of unittests:
1. removed scrapy.tests.run module which didn't work well because of a problem with Twisted trial 2. added runtests.bat script for running tests in windows 3. added additional lookup path for trial in unix systems
This commit is contained in:
parent
eb649d661d
commit
7b34e08392
|
|
@ -0,0 +1,19 @@
|
|||
@ECHO off
|
||||
|
||||
SET test="scrapy"
|
||||
IF NOT "%1" == "" SET test="%1"
|
||||
|
||||
IF EXIST c:\python26\scripts\trial.py GOTO py26
|
||||
IF EXIST c:\python25\scripts\trial.py GOTO py25
|
||||
|
||||
ECHO "Unable to run tests: trial command (included with Twisted) not found"
|
||||
GOTO end
|
||||
|
||||
:py26
|
||||
c:\python26\scripts\trial.py %test%
|
||||
GOTO end
|
||||
|
||||
:py25
|
||||
c:\python25\scripts\trial.py %test%
|
||||
|
||||
:end
|
||||
|
|
@ -3,10 +3,16 @@
|
|||
# look for twisted trial command in common known locations
|
||||
if [ -x /usr/bin/trial ]; then
|
||||
trial="/usr/bin/trial"
|
||||
elif [ -x /usr/lib/twisted/bin/trial ]; then
|
||||
trial="/usr/lib/twisted/bin/trial"
|
||||
elif [ -x /usr/lib64/twisted/bin/trial ]; then
|
||||
trial="/usr/lib64/twisted/bin/trial"
|
||||
else
|
||||
echo "Unable to run tests: trial command (included with Twisted) not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# disable custom settings for running tests in a neutral environment
|
||||
export SCRAPY_SETTINGS_DISABLED=1
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
"""
|
||||
scrapy.tests: this package contains all Scrapy unittests
|
||||
|
||||
To run all Scrapy unittests type:
|
||||
To run all Scrapy unittests go to Scrapy main dir and type:
|
||||
|
||||
python -m scrapy.tests.run
|
||||
bin/runtests.sh
|
||||
|
||||
If you're in windows use runtests.bat instead.
|
||||
|
||||
Keep in mind that some tests may be skipped if you don't have some (optional)
|
||||
modules available like MySQLdb or simplejson.
|
||||
modules available like MySQLdb or simplejson, but that's not a problem.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
"""
|
||||
Module to run Scrapy tests - see scrapy.tests docstring
|
||||
"""
|
||||
|
||||
if __name__ == '__main__':
|
||||
import os, sys
|
||||
from twisted.trial import runner, reporter
|
||||
|
||||
tests_to_run = sys.argv[1:] or ['scrapy']
|
||||
|
||||
os.environ['SCRAPY_SETTINGS_DISABLED'] = '1'
|
||||
loader = runner.TestLoader()
|
||||
runner = runner.TrialRunner(reporter.TreeReporter)
|
||||
suite = loader.loadByNames(tests_to_run, recurse=True)
|
||||
runner.run(suite)
|
||||
Loading…
Reference in New Issue