Fix deprecated warnings and add tox test