session: Fix Python 3 test errors