mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-23 21:44:19 +00:00
Merge pull request #776 from kmike/py3-tests-fix
PY3 make it possible to run some tests in Python3
This commit is contained in:
commit
4b17aa222e
@ -17,7 +17,6 @@ import sys
|
||||
if sys.version_info < (2, 7):
|
||||
print("Scrapy %s requires Python 2.7" % __version__)
|
||||
sys.exit(1)
|
||||
del sys
|
||||
|
||||
# Ignore noisy twisted deprecation warnings
|
||||
import warnings
|
||||
@ -25,7 +24,7 @@ warnings.filterwarnings('ignore', category=DeprecationWarning, module='twisted')
|
||||
del warnings
|
||||
|
||||
# Apply monkey patches to fix issues in external libraries
|
||||
import _monkeypatches
|
||||
from . import _monkeypatches
|
||||
del _monkeypatches
|
||||
|
||||
# WARNING: optional_features set is deprecated and will be removed soon. Do not use.
|
||||
@ -53,7 +52,13 @@ if twisted_version >= (11, 1, 0):
|
||||
optional_features.add('http11')
|
||||
|
||||
# Declare top-level shortcuts
|
||||
from scrapy.spider import Spider
|
||||
from scrapy.http import Request, FormRequest
|
||||
from scrapy.selector import Selector
|
||||
from scrapy.item import Item, Field
|
||||
if sys.version_info[0] == 2:
|
||||
# Top-level shortcuts are not ready for Python 3 (like most of Scrapy);
|
||||
# skip them here to make at least some parts of Scrapy
|
||||
# importable in Python 3.
|
||||
from scrapy.spider import Spider
|
||||
from scrapy.http import Request, FormRequest
|
||||
from scrapy.selector import Selector
|
||||
from scrapy.item import Item, Field
|
||||
|
||||
del sys
|
||||
|
Loading…
x
Reference in New Issue
Block a user