Skip to content

Commit fe4de1c

Browse files
author
Andrew J Westlake
committed
Changed test_harness to accept a vec instead of a stream since the stream was unnecessarily complex
1 parent 57dc464 commit fe4de1c

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

pytests/test_asyncio.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::{future::Future, thread, time::Duration};
22

3-
use futures::stream::{self};
43
use pyo3::{prelude::*, wrap_pyfunction};
54

65
use pyo3_asyncio::testing::{test_main, Test};
@@ -91,7 +90,7 @@ fn test_blocking_sleep() {
9190
}
9291

9392
fn main() {
94-
test_main(stream::iter(vec![
93+
test_main(vec![
9594
Test::new_async(
9695
"test_async_sleep".into(),
9796
Python::with_gil(|py| {
@@ -126,5 +125,5 @@ fn main() {
126125
.unwrap()
127126
}),
128127
),
129-
]))
128+
])
130129
}

src/testing.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{future::Future, pin::Pin};
22

33
use clap::{App, Arg};
4-
use futures::stream::{Stream, StreamExt};
4+
use futures::stream::{self, StreamExt};
55
use pyo3::prelude::*;
66

77
use crate::{dump_err, run_until_complete, with_runtime};
@@ -68,8 +68,8 @@ impl Test {
6868
}
6969

7070
/// Run a sequence of tests while applying any necessary filtering from the `Args`
71-
pub async fn test_harness(tests: impl Stream<Item = Test>, args: Args) -> PyResult<()> {
72-
tests
71+
pub async fn test_harness(tests: Vec<Test>, args: Args) -> PyResult<()> {
72+
stream::iter(tests)
7373
.for_each_concurrent(Some(4), |test| {
7474
let mut ignore = false;
7575

@@ -96,7 +96,7 @@ pub async fn test_harness(tests: impl Stream<Item = Test>, args: Args) -> PyResu
9696
/// This is meant to perform the necessary initialization for most test cases. If you want
9797
/// additional control over the initialization (i.e. env_logger initialization), you can use this
9898
/// function as a template.
99-
pub fn test_main(tests: impl Stream<Item = Test> + Send + 'static) {
99+
pub fn test_main(tests: Vec<Test>) {
100100
Python::with_gil(|py| {
101101
with_runtime(py, || {
102102
let args = parse_args("Pyo3 Asyncio Test Suite");

0 commit comments

Comments
 (0)