C27KPBKKDMVRQUNGEP4TKU4ITMFAWXRZR3HYSPWNEPFVBJXNCC3QC
JSBM2RCBQG5L5ULSXLKDJL2MJTE5UETMHXVFKKGYZEVLELNYBCRQC
TXHTORSMXMKDSGFNFIKQZYIY3KBDKJF2DJPA55NW4R6ZYBCQKRVQC
N7U2FHPRHGARPZ6M7LYBDJ52NMYE23VD5YALZ7CC76W3V5OLBP7QC
MDCKAPJFOWFR5HBN3CU6ZGKYXP3QND5H5IV53ZKT34HPTR3YAEDAC
YTH3GCSKUG34XBAAVP65UA67C26K2JDDL2N6PGYLKL2GG3MGFU6AC
EKYR4HDT6DHI7H5YMSHEBHXLPDCA2X2XNXYHDKHWGMPHNVTUBCMQC
LD2Y3TFPUQQXQUYWL2LRAL4WRPCKC3H5TLPSMY6VCDJCDKJYUDJQC
CITEDKPB6MKVZUEYEDE5ZKTNVY35HCOAXKDPYG7YLLEOVFNMSRXQC
BZSTVYDVHJA3ZMCM3YTU4U5JKJC2JVUDM5APSBIGMSS54J2C4WKQC
test-msrv:
name: Test Suite
runs-on: ubuntu-latest
strategy:
matrix:
features:
- # default
- --no-default-features
- --features track-caller
# skip `--features pyo3` and `--all-features` because pyo3 doesn't support this msrv
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.39
override: true
- uses: actions-rs/cargo@v1
with:
command: test
file="CHANGELOG.md"
search="<!-- next-url -->"
replace="<!-- next-url -->\n[Unreleased]: https://github.com/yaahc/{{crate_name}}/compare/{{tag_name}}...HEAD"
exactly=1
file = "CHANGELOG.md"
search = "<!-- next-url -->"
replace = "<!-- next-url -->\n[Unreleased]: https://github.com/yaahc/{{crate_name}}/compare/{{tag_name}}...HEAD"
exactly = 1
use crate::Report;
impl From<Report> for pyo3::PyErr {
fn from(error: Report) -> Self {
pyo3::exceptions::PyRuntimeError::new_err(format!("{:?}", error))
}
}
#![cfg(feature = "pyo3")]
use pyo3::prelude::*;
use eyre::{bail, Result, WrapErr};
fn f() -> Result<()> {
use std::io;
bail!(io::Error::new(io::ErrorKind::PermissionDenied, "oh no!"));
}
fn g() -> Result<()> {
f().wrap_err("f failed")
}
fn h() -> Result<()> {
g().wrap_err("g failed")
}
#[test]
fn test_pyo3_exception_contents() {
use pyo3::types::IntoPyDict;
let err = h().unwrap_err();
let expected_contents = format!("{:?}", err);
let pyerr = PyErr::from(err);
Python::with_gil(|py| {
let locals = [("err", pyerr)].into_py_dict(py);
let pyerr = py.run("raise err", None, Some(locals)).unwrap_err();
assert_eq!(pyerr.pvalue(py).to_string(), expected_contents);
})
}