Skip to content

Commit

Permalink
Add test for #219
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Sep 17, 2018
1 parent f8adb45 commit 0372360
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
7 changes: 6 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
9 changes: 9 additions & 0 deletions examples/rustapi_module/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))?;
Expand All @@ -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(())
}
2 changes: 2 additions & 0 deletions examples/rustapi_module/tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion pyo3-derive-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
2 changes: 1 addition & 1 deletion pyo3cls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

0 comments on commit 0372360

Please sign in to comment.