1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-25 11:43:45 +00:00
scrapy/tests/__init__.py
Berker Peksag 31e5f164d4 Import unittest.mock if available.
mock is in the stdlib since Python 3.3.
2015-03-08 15:03:04 +02:00

20 lines
438 B
Python

"""
tests: this package contains all Scrapy unittests
see http://doc.scrapy.org/en/latest/contributing.html#running-tests
"""
import os
try:
import unittest.mock as mock
except ImportError:
import mock
tests_datadir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'sample_data')
def get_testdata(*paths):
"""Return test data"""
path = os.path.join(tests_datadir, *paths)
return open(path, 'rb').read()