Add test for #219

This commit is contained in:
konstin 2018-09-17 19:46:50 +02:00
parent f8adb456b8
commit 0372360811
6 changed files with 20 additions and 4 deletions

View File

@ -11,7 +11,7 @@ repository = "https://github.com/pyo3/pyo3"
#documentation = "https://docs.rs/crate/pyo3/"
categories = ["api-bindings", "development-tools::ffi"]
license = "Apache-2.0"
exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"]
exclude = ["/.gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"]
build = "build.rs"
[badges]

View File

@ -175,7 +175,12 @@ fn run_python_script(interpreter: &str, script: &str) -> Result<String, String>
.args(&["-c", script])
.stderr(Stdio::inherit())
.output()
.map_err(|e| format!("Failed to run the python interpreter at {}: {}", interpreter, e))?;
.map_err(|e| {
format!(
"Failed to run the python interpreter at {}: {}",
interpreter, e
)
})?;
if !out.status.success() {
return Err(format!("python script failed"));

View File

@ -192,6 +192,13 @@ fn datetime_from_timestamp(py: Python, ts: f64, tz: Option<&PyTzInfo>) -> PyResu
PyDateTime::from_timestamp(py, &args.to_object(py), &kwargs.to_object(py))
}
#[pyfunction]
fn issue_219() -> PyResult<()> {
let gil = Python::acquire_gil();
let py = gil.python();
Ok(())
}
#[pymodinit]
fn datetime(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_function!(make_date))?;
@ -213,5 +220,7 @@ fn datetime(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_function!(get_datetime_tuple_fold));
}
m.add_function(wrap_function!(issue_219))?;
Ok(())
}

View File

@ -261,3 +261,5 @@ def test_delta_err(args, err_type):
with pytest.raises(err_type):
rdt.make_delta(*args)
def test_issue_219():
rdt.issue_219()

View File

@ -12,4 +12,4 @@ license = "Apache-2.0"
[dependencies]
quote = "0.6.8"
proc-macro2 = "0.4.19"
syn = { version = "0.15.3", features = ["full", "extra-traits"] }
syn = { version = "0.15.4", features = ["full", "extra-traits"] }

View File

@ -15,5 +15,5 @@ proc-macro = true
[dependencies]
quote= "0.6.8"
proc-macro2 = "0.4.19"
syn = { version = "0.15.3", features = ["full", "extra-traits"] }
syn = { version = "0.15.4", features = ["full", "extra-traits"] }
pyo3-derive-backend = { path = "../pyo3-derive-backend", version = "=0.5.0" }