@mock.patch.object(subprocess, 'Popen', autospec=True)
    def test__exec_bash_cmd(self, mock_popen):
        mock_proc = mock.Mock()
        mock_popen.return_value = mock_proc
        mock_proc.communicate.return_value = ["baz", "qux"]
        mock_proc.returncode = 1
        with pytest.raises(exception.VirtualenvError) as exc_info:
            virtualenv_proxy._exec_shell_cmd(
                "bash_ninja",
                stdout=42,
                stderr=666,
                err_msg="bar",
            )

        assert "bar" in str(exc_info.value)
        mock_popen.assert_called_once_with(
            "bash_ninja", stdout=42, stderr=666)
        mock_proc.communicate.assert_called_once_with()
dataset/ETHPy150Open Yelp/pyleus/tests/cli/virtualenv_proxy_test.py/TestVirtualenvProxyTopLevelFunctions.test__exec_bash_cmd/original