def test_raises_multierror_2_errors(): """ raises_multierror_with_one_exception fails if MultiError has too many excs """ dummy_task1 = asyncio_run(create_failing_task()) dummy_task2 = asyncio_run(create_failing_task()) with pytest.raises(BaseException): with raises_multierror_with_one_exception(AssertionError): raise MultiError([dummy_task1, dummy_task2])
def test_raises_multierror_different_exception(): """raises_multierror_with_one_exception fails if MultiError has bad error """ dummy_task = asyncio_run(create_failing_task()) with pytest.raises(BaseException): with raises_multierror_with_one_exception(TypeError): raise MultiError([dummy_task])
def test_raises_multierror(): """raises_multierror_with_one_exception exposes correct exception info """ dummy_task = asyncio_run(create_failing_task()) with raises_multierror_with_one_exception(AssertionError) as e: raise MultiError([dummy_task]) assert e.type == AssertionError assert isinstance(e.value, AssertionError) assert isinstance(e.freezeyt_task, TaskInfo) assert e.freezeyt_task._task == dummy_task
def test_links_css_async(test_name): (content, *args), expected = TEST_DATA[test_name] f = BytesIO(content) links = asyncio_run(get_html_links_async(f, *args)) assert sorted(links) == expected
def test_links_css_async(test_name): input, expected = TEST_DATA[test_name] f = BytesIO(input) links = asyncio_run(get_css_links_async(f, 'http://localhost:8000')) assert sorted(links) == expected
def freeze(app, config): return asyncio_run(freeze_async(app, config))