diff --git a/setup.py b/setup.py index 760fc92f..5f04a9f2 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ install_requires = [ 'automat==20.2.0', - 'amqp~=2.0,>2.2.0,!=2.3.0', + 'amqp', 'autosemver~=0.2', "backports.tempfile==1.0", 'boto3~=1.14', @@ -27,6 +27,7 @@ 'inspire-utils~=3.0,>=3.0.0', # newer scrapy is incompatible with old scrapyd 'Scrapy~=1.6,<1.7.0', + 'parsel<=1.8.0', 'scrapy-crawl-once~=0.1,>=0.1.1', 'scrapy-sentry~=0.0,>=0.8.0', # TODO: unpin once they support wheel building again, needed for Python 3 @@ -45,13 +46,14 @@ 'harvestingkit>=0.6.12', 'Sickle~=0.6,>=0.6.2', # newer versions seem incompatible with required scrapyd version - 'Twisted~=18.0,>=18.9.0', + 'Twisted~=18.0,>=18.9.0; python_version == "2.7"', + 'Twisted>=21.2.0; python_version >= "3"', #latex parsing 'pylatexenc~=2.9', - 'queuelib==1.5.0', - 'sentry-sdk==1.3.0', - 'structlog==20.1.0', - 'python-logstash==0.4.8', + 'queuelib>=1.5.0', + 'sentry-sdk>=0.10.0', + 'structlog>=19.0.0', + 'python-logstash>=0.4.8', ] tests_require = [ @@ -61,7 +63,7 @@ 'freezegun>=0.3.9', 'isort==4.2.2', 'mock~=2.0,>=2.0.0', - 'pytest>=2.8.0', + 'pytest>=2.8.0, <8.0.0', 'pytest-cov>=2.1.0', 'pytest-pep8>=1.0.6', 'requests-mock>=1.3.0', diff --git a/tests/unit/test_desy.py b/tests/unit/test_desy.py index d9a6853c..0cdb66d7 100644 --- a/tests/unit/test_desy.py +++ b/tests/unit/test_desy.py @@ -10,7 +10,7 @@ from __future__ import absolute_import, division, print_function import os - +import sys import mock import pytest from deepdiff import DeepDiff @@ -106,6 +106,8 @@ def override_generated_fields(record): ] ) def test_pipeline(generated_records, expected_records): + if sys.version_info[0] >= 3: + unicode = str clean_generated_records = [ override_generated_fields(generated_record) for generated_record in generated_records @@ -126,6 +128,10 @@ def test_invalid_jsonll(): response.meta = {"s3_subdirectory": 'invalid_record'} result = list(spider.parse(response)) - assert result[0].exception.startswith('ValueError') + exception = result[0].exception + if exception.startswith('ValueError') or exception.startswith('JSONDecodeError'): + assert True + else: + assert False assert result[0].traceback is not None assert result[0].source_data == "This is not actually JSONL" diff --git a/tests/unit/test_settings.py b/tests/unit/test_settings.py index 44967ba7..4ec42585 100644 --- a/tests/unit/test_settings.py +++ b/tests/unit/test_settings.py @@ -8,7 +8,7 @@ # more details. import logging - +import sys from scrapy.utils.project import get_project_settings from scrapy.utils.log import (configure_logging, logger) @@ -21,4 +21,7 @@ def test_log_settings(): configure_logging(settings=settings) assert any(isinstance(handler, logging.StreamHandler) for handler in logger.root.handlers) - assert not any(isinstance(handler, logging.FileHandler) for handler in logger.root.handlers) + if sys.version_info[0] >= 3: + assert any(isinstance(handler, logging.FileHandler) and handler.level == logging.NOTSET for handler in logger.root.handlers) + else: + assert not any(isinstance(handler, logging.FileHandler) for handler in logger.root.handlers) \ No newline at end of file