2015-04-16 18:20:50 +05:00
|
|
|
import glob
|
2014-07-30 19:41:12 -03:00
|
|
|
import six
|
2014-04-04 16:38:09 -03:00
|
|
|
import pytest
|
2015-12-02 17:05:44 +01:00
|
|
|
from twisted import version as twisted_version
|
2014-04-04 16:38:09 -03:00
|
|
|
|
2015-04-16 18:20:50 +05:00
|
|
|
|
|
|
|
def _py_files(folder):
|
|
|
|
return glob.glob(folder + "/*.py") + glob.glob(folder + "/*/*.py")
|
|
|
|
|
|
|
|
|
|
|
|
collect_ignore = [
|
2015-08-01 00:43:13 +05:00
|
|
|
# deprecated or moved modules
|
2015-04-16 18:20:50 +05:00
|
|
|
"scrapy/conf.py",
|
|
|
|
"scrapy/stats.py",
|
|
|
|
"scrapy/project.py",
|
|
|
|
"scrapy/utils/decorator.py",
|
|
|
|
"scrapy/statscol.py",
|
|
|
|
"scrapy/squeue.py",
|
|
|
|
"scrapy/log.py",
|
|
|
|
"scrapy/dupefilter.py",
|
2015-04-28 15:28:58 -03:00
|
|
|
"scrapy/command.py",
|
2015-04-28 15:44:22 -03:00
|
|
|
"scrapy/linkextractor.py",
|
2015-05-09 04:21:50 -03:00
|
|
|
"scrapy/spider.py",
|
2015-08-01 00:43:13 +05:00
|
|
|
|
|
|
|
# not a test, but looks like a test
|
|
|
|
"scrapy/utils/testsite.py",
|
|
|
|
|
2015-04-16 18:20:50 +05:00
|
|
|
] + _py_files("scrapy/contrib") + _py_files("scrapy/contrib_exp")
|
|
|
|
|
2015-12-02 17:05:44 +01:00
|
|
|
if (twisted_version.major, twisted_version.minor, twisted_version.micro) >= (15, 5, 0):
|
|
|
|
collect_ignore += _py_files("scrapy/xlib/tx")
|
|
|
|
|
2014-04-04 16:55:35 -03:00
|
|
|
|
2014-07-30 19:41:12 -03:00
|
|
|
if six.PY3:
|
2015-02-09 10:28:22 +01:00
|
|
|
for line in open('tests/py3-ignores.txt'):
|
2015-02-10 10:34:44 +01:00
|
|
|
file_path = line.strip()
|
2016-01-18 07:45:36 +01:00
|
|
|
if file_path and file_path[0] != '#':
|
2015-02-10 10:34:44 +01:00
|
|
|
collect_ignore.append(file_path)
|
2014-04-04 16:38:09 -03:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture()
|
|
|
|
def chdir(tmpdir):
|
|
|
|
"""Change to pytest-provided temporary directory"""
|
|
|
|
tmpdir.chdir()
|