Made builtins mocking in tests py3 compatible

Uses an import try-catch to determine the correct name for the builtins module.