How to Import Python Blender Modules in PyCharm IDE
Try running these two lines in your terminal and see how your test works afterwards. I had the exact same problem when I built the module.

sudo mkdir "/Library/Application Support/Blender"
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/2.77 "/Library/Application Support/Blender/2.77"


Python isn't recognizing the bpy module because Blender's unique import protocol searches for /Library/Application Support/Blender/2.77 before the Python site packages. You can work around this by creating a symbolic link that leads to /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/2.77. Your test should work once you do that.