From 8140dc99ecf3a11c5eb33f75d2ecc99cfcbac171 Mon Sep 17 00:00:00 2001 From: Andrew J Westlake Date: Sat, 23 Jan 2021 11:02:01 -0600 Subject: [PATCH] Fixed typo in README, flattened sections in Cargo Test portion of guide --- README.md | 2 +- guide/src/async-await.md | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 61f8c9f4..d6ecac46 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ about this topic. * [dict-derive](https://github.com/gperinazzo/dict-derive) _Derive FromPyObject to automatically transform Python dicts into Rust structs_ * [pyo3-log](https://github.com/vorner/pyo3-log) _Bridge from Rust to Python logging_ * [pythonize](https://github.com/davidhewitt/pythonize) _Serde serializer for converting Rust objects to JSON-compatible Python objects_ - * [pyo3-asyncio](https://github.com/awestlake87/pyo3-asyncio) Utilities for working with Python's and Asyncio library and async functions + * [pyo3-asyncio](https://github.com/awestlake87/pyo3-asyncio) Utilities for working with Python's Asyncio library and async functions ## Examples diff --git a/guide/src/async-await.md b/guide/src/async-await.md index 3ab8591c..daba30fb 100644 --- a/guide/src/async-await.md +++ b/guide/src/async-await.md @@ -152,9 +152,7 @@ thread. We can, however, override the default test harness and provide our own. `pyo3-asyncio` provides some utilities to help us do just that! -### Creating A PyO3 Asyncio Integration Test - -#### Main Test File +### Main Test File First, we need to create the test's main file. Although these tests are considered integration tests, we cannot put them in the `tests` directory since that is a special directory owned by Cargo. Instead, we put our tests in a `pytests` directory, although the name `pytests` is just @@ -167,7 +165,7 @@ fn main() { } ``` -#### Test Manifest Entry +### Test Manifest Entry Next, we need to add our test file to the Cargo manifest. Add the following section to your `Cargo.toml` @@ -180,7 +178,7 @@ harness = false At this point you should be able to run the test via `cargo test` -#### Using the PyO3 Asyncio Test Harness +### Using the PyO3 Asyncio Test Harness Now that we've got our test registered with `cargo test`, we can start using the PyO3 Asyncio test harness. @@ -197,7 +195,7 @@ fn main() { } ``` -##### Tokio's Main Function +#### Tokio's Main Function As we mentioned earlier, Tokio requires some additional initialization. If you're going to use the Tokio runtime, you'll need to call one of the initialization functions in the `pyo3_asyncio::tokio` @@ -211,7 +209,7 @@ fn main() { ``` -#### Adding Tests to the PyO3 Asyncio Test Harness +### Adding Tests to the PyO3 Asyncio Test Harness ```rust use std::{time::Duration, thread};