mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
tests: add 'importorskip' for tests that require 'extra' dependencies, (youtube-dl, socks), addresses #270
setup: remove 2.6 classifier, update repo path bump to 2.0.1
This commit is contained in:
parent
610b6414a3
commit
e2fa14bc2d
@ -1,4 +1,4 @@
|
|||||||
__version__ = '2.0.0'
|
__version__ = '2.0.1'
|
||||||
|
|
||||||
DEFAULT_CONFIG = 'pywb/default_config.yaml'
|
DEFAULT_CONFIG = 'pywb/default_config.yaml'
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ from pywb.warcserver.test.testutils import FakeRedisTests
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import webtest
|
import webtest
|
||||||
|
import pytest
|
||||||
|
|
||||||
from pytest import raises
|
|
||||||
from fakeredis import FakeStrictRedis
|
from fakeredis import FakeStrictRedis
|
||||||
|
|
||||||
from pywb.recorder.recorderapp import RecorderApp
|
from pywb.recorder.recorderapp import RecorderApp
|
||||||
@ -607,6 +607,7 @@ class TestRecorder(LiveServerTests, FakeRedisTests, TempDirTests, BaseTestClass)
|
|||||||
assert len(writer.fh_cache) == 0
|
assert len(writer.fh_cache) == 0
|
||||||
|
|
||||||
def test_record_video_metadata(self):
|
def test_record_video_metadata(self):
|
||||||
|
pytest.importorskip('youtube-dl')
|
||||||
warc_path = to_path(self.root_dir + '/warcs/{user}/{coll}/')
|
warc_path = to_path(self.root_dir + '/warcs/{user}/{coll}/')
|
||||||
|
|
||||||
dedup_index = self._get_dedup_index()
|
dedup_index = self._get_dedup_index()
|
||||||
|
@ -7,6 +7,7 @@ from six.moves.urllib.parse import urlencode
|
|||||||
import webtest
|
import webtest
|
||||||
from fakeredis import FakeStrictRedis
|
from fakeredis import FakeStrictRedis
|
||||||
from mock import patch
|
from mock import patch
|
||||||
|
import pytest
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@ -380,6 +381,7 @@ foo=bar&test=abc"""
|
|||||||
assert resp.headers['Memento-Datetime'] == 'Mon, 29 Jul 2013 19:51:51 GMT'
|
assert resp.headers['Memento-Datetime'] == 'Mon, 29 Jul 2013 19:51:51 GMT'
|
||||||
|
|
||||||
def test_live_video_loader(self):
|
def test_live_video_loader(self):
|
||||||
|
pytest.importorskip('youtube-dl')
|
||||||
params = {'url': 'http://www.youtube.com/v/BfBgWtAIbRc',
|
params = {'url': 'http://www.youtube.com/v/BfBgWtAIbRc',
|
||||||
'content_type': 'application/vnd.youtube-dl_formats+json'
|
'content_type': 'application/vnd.youtube-dl_formats+json'
|
||||||
}
|
}
|
||||||
@ -397,6 +399,7 @@ foo=bar&test=abc"""
|
|||||||
assert b'Content-Type: application/vnd.youtube-dl_formats+json' in resp.body
|
assert b'Content-Type: application/vnd.youtube-dl_formats+json' in resp.body
|
||||||
|
|
||||||
def test_live_video_loader_post(self):
|
def test_live_video_loader_post(self):
|
||||||
|
pytest.importorskip('youtube-dl')
|
||||||
req_data = """\
|
req_data = """\
|
||||||
GET /v/BfBgWtAIbRc HTTP/1.1
|
GET /v/BfBgWtAIbRc HTTP/1.1
|
||||||
accept-encoding: gzip, deflate
|
accept-encoding: gzip, deflate
|
||||||
|
6
setup.py
6
setup.py
@ -79,7 +79,7 @@ generate_git_hash_py('pywb')
|
|||||||
setup(
|
setup(
|
||||||
name='pywb',
|
name='pywb',
|
||||||
version=__version__,
|
version=__version__,
|
||||||
url='https://github.com/ikreymer/pywb',
|
url='https://github.com/webrecorder/pywb',
|
||||||
author='Ilya Kreymer',
|
author='Ilya Kreymer',
|
||||||
author_email='ikreymer@gmail.com',
|
author_email='ikreymer@gmail.com',
|
||||||
description='Pywb Webrecorder web archive replay and capture tools',
|
description='Pywb Webrecorder web archive replay and capture tools',
|
||||||
@ -100,9 +100,6 @@ setup(
|
|||||||
glob.glob('sample_archive/text_content/*')),
|
glob.glob('sample_archive/text_content/*')),
|
||||||
],
|
],
|
||||||
install_requires=load_requirements('requirements.txt'),
|
install_requires=load_requirements('requirements.txt'),
|
||||||
dependency_links=[
|
|
||||||
#'git+https://github.com/t0m/pyamf.git@python3#egg=pyamf-0.8.0'
|
|
||||||
],
|
|
||||||
tests_require=[
|
tests_require=[
|
||||||
'pytest',
|
'pytest',
|
||||||
'WebTest',
|
'WebTest',
|
||||||
@ -130,7 +127,6 @@ setup(
|
|||||||
'License :: OSI Approved :: GNU General Public License (GPL)',
|
'License :: OSI Approved :: GNU General Public License (GPL)',
|
||||||
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
|
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
|
||||||
'Programming Language :: Python :: 2',
|
'Programming Language :: Python :: 2',
|
||||||
'Programming Language :: Python :: 2.6',
|
|
||||||
'Programming Language :: Python :: 2.7',
|
'Programming Language :: Python :: 2.7',
|
||||||
'Programming Language :: Python :: 3',
|
'Programming Language :: Python :: 3',
|
||||||
'Programming Language :: Python :: 3.3',
|
'Programming Language :: Python :: 3.3',
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from .base_config_test import BaseConfigTest, fmod_sl
|
from .base_config_test import BaseConfigTest, fmod_sl
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
@ -53,6 +54,7 @@ class TestLiveRewriter(BaseConfigTest):
|
|||||||
assert resp.status_int == 400
|
assert resp.status_int == 400
|
||||||
|
|
||||||
def test_live_video_info(self):
|
def test_live_video_info(self):
|
||||||
|
pytest.importorskip('youtube-dl')
|
||||||
resp = self.testapp.get('/live/vi_/https://www.youtube.com/watch?v=DjFZyFWSt1M')
|
resp = self.testapp.get('/live/vi_/https://www.youtube.com/watch?v=DjFZyFWSt1M')
|
||||||
assert resp.status_int == 200
|
assert resp.status_int == 200
|
||||||
assert resp.content_type == 'application/vnd.youtube-dl_formats+json', resp.content_type
|
assert resp.content_type == 'application/vnd.youtube-dl_formats+json', resp.content_type
|
||||||
|
@ -11,6 +11,7 @@ import pytest
|
|||||||
class TestSOCKSProxy(BaseConfigTest):
|
class TestSOCKSProxy(BaseConfigTest):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_class(cls):
|
def setup_class(cls):
|
||||||
|
pytest.importorskip('socks')
|
||||||
os.environ['SOCKS_HOST'] = 'localhost'
|
os.environ['SOCKS_HOST'] = 'localhost'
|
||||||
os.environ['SOCKS_PORT'] = '0'
|
os.environ['SOCKS_PORT'] = '0'
|
||||||
|
|
||||||
@ -30,7 +31,6 @@ class TestSOCKSProxy(BaseConfigTest):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def test_socks_attempt_connect(self, fmod_sl):
|
def test_socks_attempt_connect(self, fmod_sl):
|
||||||
pytest.importorskip('socks')
|
|
||||||
# no proxy is set, expect to fail if socks is being used
|
# no proxy is set, expect to fail if socks is being used
|
||||||
resp = self.get('/live/{0}http://httpbin.org/get', fmod_sl, status=400)
|
resp = self.get('/live/{0}http://httpbin.org/get', fmod_sl, status=400)
|
||||||
assert resp.status_int == 400
|
assert resp.status_int == 400
|
||||||
|
Loading…
x
Reference in New Issue
Block a user