mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-06-20 12:54:23 -04:00
Merge branch 'master' into safe-thread-raise
This commit is contained in:
commit
dcf4811470
3 changed files with 30 additions and 2 deletions
|
@ -660,6 +660,9 @@ def brozzler_stop_crawl(argv=None):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
job_id = args.job_id
|
job_id = args.job_id
|
||||||
job = brozzler.Job.load(rr, 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.stop_requested = doublethink.utcnow()
|
||||||
job.save()
|
job.save()
|
||||||
elif args.site_id:
|
elif args.site_id:
|
||||||
|
@ -668,6 +671,9 @@ def brozzler_stop_crawl(argv=None):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
site_id = args.site_id
|
site_id = args.site_id
|
||||||
site = brozzler.Site.load(rr, 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.stop_requested = doublethink.utcnow()
|
||||||
site.save()
|
site.save()
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -32,7 +32,7 @@ def find_package_data(package):
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='brozzler',
|
name='brozzler',
|
||||||
version='1.1b11.dev238',
|
version='1.1b11.dev240',
|
||||||
description='Distributed web crawling with browsers',
|
description='Distributed web crawling with browsers',
|
||||||
url='https://github.com/internetarchive/brozzler',
|
url='https://github.com/internetarchive/brozzler',
|
||||||
author='Noah Levitt',
|
author='Noah Levitt',
|
||||||
|
|
|
@ -21,6 +21,7 @@ import brozzler.cli
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import pytest
|
import pytest
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import doublethink
|
||||||
|
|
||||||
def cli_commands():
|
def cli_commands():
|
||||||
commands = set(pkg_resources.get_entry_map(
|
commands = set(pkg_resources.get_entry_map(
|
||||||
|
@ -36,7 +37,6 @@ def cli_commands():
|
||||||
commands.remove('brozzler-easy')
|
commands.remove('brozzler-easy')
|
||||||
return commands
|
return commands
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('cmd', cli_commands())
|
@pytest.mark.parametrize('cmd', cli_commands())
|
||||||
def test_call_entrypoint(capsys, cmd):
|
def test_call_entrypoint(capsys, cmd):
|
||||||
entrypoint = pkg_resources.get_entry_map(
|
entrypoint = pkg_resources.get_entry_map(
|
||||||
|
@ -57,3 +57,25 @@ def test_run_command(capsys, cmd):
|
||||||
brozzler.__version__, cmd)).encode('ascii')
|
brozzler.__version__, cmd)).encode('ascii')
|
||||||
assert err == b''
|
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…
Add table
Add a link
Reference in a new issue