diff --git a/Makefile b/Makefile index 92ce3a17..6fa2029f 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,6 @@ default: test test: cargo test $(CARGO_FLAGS) - pip install setuptools-rust pytest pytest-benchmark tox - cd examples/word-count && python setup.py install && pytest -v tests + pip install tox + cd examples/word-count && tox cd examples/rustapi_module && tox diff --git a/src/lib.rs b/src/lib.rs index 2af1a63f..64bbf738 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,7 +44,8 @@ //! //! let locals = PyDict::new(py); //! locals.set_item("os", py.import("os")?)?; -//! let user: String = py.eval("os.getenv('USER') or os.getenv('USERNAME')", None, Some(&locals))?.extract()?; +//! let code = "os.getenv('USER') or os.getenv('USERNAME') or 'Unknown'"; +//! let user: String = py.eval(code, None, Some(&locals))?.extract()?; //! //! println!("Hello {}, I'm Python {}", user, version); //! Ok(()) diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..d6d99d0c --- /dev/null +++ b/tox.ini @@ -0,0 +1,14 @@ +[tox] +envlist = py27, + py35, + py36, + py37, +minversion = 3.4.0 +skip_missing_interpreters = true + +[testenv] +description = Run the unit tests under {basepython} +skip_install = True +usedevelop = True +whitelist_externals = cargo +commands = cargo test src/lib.rs