def test_cannot_event_with_no_context(): with pytest.raises(InvalidArgument): event('hi') assert _current_build_context.value is None