Update and fix test setup.

This commit is contained in:
Dorian 2019-11-15 11:45:57 -05:00
parent 85bd911959
commit b13cab107b
3 changed files with 10 additions and 5 deletions

View File

@ -7,7 +7,11 @@ license = "Apache-2.0"
[lib] [lib]
name = "unit_converter" name = "unit_converter"
crate-type = ["cdylib"] crate-type = ["cdylib", "rlib"]
[dependencies] [dependencies.pyo3]
pyo3 = { version = "0.8", features = ["extension-module"] } version = "0.8"
[features]
extension-module = ["pyo3/extension-module"]
default = ["extension-module"]

View File

@ -20,7 +20,8 @@ Insure the following dependencies are in place:
1. Build the rust crate first: `cargo build` 1. Build the rust crate first: `cargo build`
1. Install dependencies and run in a virtualenv: `pipenv install && pipenv shell` 1. Install dependencies and run in a virtualenv: `pipenv install && pipenv shell`
1. Create the Python package with: `maturin build` 1. Create the Python package with: `maturin build`
1. Run the tests: `pytest test.py` 1. Run the Python tests: `pytest test.py batch_test.py`
1. Run the Rust test: `cargo test --no-default-features`
## Documentation ## Documentation

View File

@ -63,6 +63,6 @@ mod tests {
#[test] #[test]
fn windchill_test() { fn windchill_test() {
let temperature = Temperature{ celsius: -20.0 }; let temperature = Temperature{ celsius: -20.0 };
assert_eq!(temperature.windchill(32.0).round(), -32.9); assert_eq!(temperature.windchill(32.0).round(), -33.0);
} }
} }