mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-04-19 15:25:59 -04:00
Merge branch 'master' into safe-thread-raise
This commit is contained in:
commit
dcf4811470
@ -660,6 +660,9 @@ def brozzler_stop_crawl(argv=None):
|
||||
except ValueError:
|
||||
job_id = args.job_id
|
||||
job = brozzler.Job.load(rr, job_id)
|
||||
if not job:
|
||||
logging.fatal('job not found with id=%s', repr(job_id))
|
||||
sys.exit(1)
|
||||
job.stop_requested = doublethink.utcnow()
|
||||
job.save()
|
||||
elif args.site_id:
|
||||
@ -668,6 +671,9 @@ def brozzler_stop_crawl(argv=None):
|
||||
except ValueError:
|
||||
site_id = args.site_id
|
||||
site = brozzler.Site.load(rr, site_id)
|
||||
if not site:
|
||||
logging.fatal('site not found with id=%s', repr(site_id))
|
||||
sys.exit(1)
|
||||
site.stop_requested = doublethink.utcnow()
|
||||
site.save()
|
||||
|
||||
|
2
setup.py
2
setup.py
@ -32,7 +32,7 @@ def find_package_data(package):
|
||||
|
||||
setuptools.setup(
|
||||
name='brozzler',
|
||||
version='1.1b11.dev238',
|
||||
version='1.1b11.dev240',
|
||||
description='Distributed web crawling with browsers',
|
||||
url='https://github.com/internetarchive/brozzler',
|
||||
author='Noah Levitt',
|
||||
|
@ -21,6 +21,7 @@ import brozzler.cli
|
||||
import pkg_resources
|
||||
import pytest
|
||||
import subprocess
|
||||
import doublethink
|
||||
|
||||
def cli_commands():
|
||||
commands = set(pkg_resources.get_entry_map(
|
||||
@ -36,7 +37,6 @@ def cli_commands():
|
||||
commands.remove('brozzler-easy')
|
||||
return commands
|
||||
|
||||
|
||||
@pytest.mark.parametrize('cmd', cli_commands())
|
||||
def test_call_entrypoint(capsys, cmd):
|
||||
entrypoint = pkg_resources.get_entry_map(
|
||||
@ -57,3 +57,25 @@ def test_run_command(capsys, cmd):
|
||||
brozzler.__version__, cmd)).encode('ascii')
|
||||
assert err == b''
|
||||
|
||||
def test_rethinkdb_up():
|
||||
'''Check that rethinkdb is up and running.'''
|
||||
# check that rethinkdb is listening and looks sane
|
||||
rr = doublethink.Rethinker(db='rethinkdb') # built-in db
|
||||
tbls = rr.table_list().run()
|
||||
assert len(tbls) > 10
|
||||
|
||||
# XXX don't know why this test is failing in travis-ci and vagrant while
|
||||
# test_call_entrypoint tests pass :( (also fails with capfd)
|
||||
@pytest.mark.xfail
|
||||
def test_stop_nonexistent_crawl(capsys):
|
||||
with pytest.raises(SystemExit):
|
||||
brozzler.cli.brozzler_stop_crawl(['brozzler-stop-crawl', '--site=123'])
|
||||
out, err = capsys.readouterr()
|
||||
assert err.endswith('site not found with id=123\n')
|
||||
assert out == ''
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
brozzler.cli.brozzler_stop_crawl(['brozzler-stop-crawl', '--job=abc'])
|
||||
out, err = capsys.readouterr()
|
||||
assert err.endswith('''job not found with id='abc'\n''')
|
||||
assert out == ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user