def test__shares_exec_prefix(): import sys old_ex = sys.exec_prefix try: sys.exec_prefix = "/foo/bar" assert biu._shares_exec_prefix("/foo/bar") == True sys.exec_prefix = "/baz/bar" assert biu._shares_exec_prefix("/foo/bar") == False sys.exec_prefix = None assert biu._shares_exec_prefix("/foo/bar") == False finally: sys.exec_prefix = old_ex