Skip to content

Commit c9b344b

Browse files
committed
feat: single threaded flavors
1 parent 6ebced4 commit c9b344b

File tree

23 files changed

+116
-118
lines changed

23 files changed

+116
-118
lines changed

host/tests/integration_tests/python/argument_forms.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use datafusion_expr::{
1515

1616
use crate::integration_tests::python::test_utils::python_scalar_udf;
1717

18-
#[tokio::test(flavor = "multi_thread")]
18+
#[tokio::test]
1919
async fn test_positional_or_keyword() {
2020
const CODE: &str = "
2121
def foo(x: int) -> int:
@@ -55,7 +55,7 @@ def foo(x: int) -> int:
5555
);
5656
}
5757

58-
#[tokio::test(flavor = "multi_thread")]
58+
#[tokio::test]
5959
async fn test_positional_or_keyword_default() {
6060
const CODE: &str = "
6161
def foo(x: int = 1) -> int:
@@ -77,7 +77,7 @@ def foo(x: int = 1) -> int:
7777
);
7878
}
7979

80-
#[tokio::test(flavor = "multi_thread")]
80+
#[tokio::test]
8181
async fn test_positional_only() {
8282
const CODE: &str = "
8383
def foo(x: int, /) -> int:
@@ -117,7 +117,7 @@ def foo(x: int, /) -> int:
117117
);
118118
}
119119

120-
#[tokio::test(flavor = "multi_thread")]
120+
#[tokio::test]
121121
async fn test_positional_only_default() {
122122
const CODE: &str = "
123123
def foo(x: int = 1, /) -> int:
@@ -139,7 +139,7 @@ def foo(x: int = 1, /) -> int:
139139
);
140140
}
141141

142-
#[tokio::test(flavor = "multi_thread")]
142+
#[tokio::test]
143143
async fn test_positional_or_keyword_and_positional_only() {
144144
const CODE: &str = "
145145
def foo(x: int, /, y: int) -> int:
@@ -182,7 +182,7 @@ def foo(x: int, /, y: int) -> int:
182182
);
183183
}
184184

185-
#[tokio::test(flavor = "multi_thread")]
185+
#[tokio::test]
186186
async fn test_var_positional() {
187187
const CODE: &str = "
188188
def foo(*x: int) -> int:
@@ -204,7 +204,7 @@ def foo(*x: int) -> int:
204204
);
205205
}
206206

207-
#[tokio::test(flavor = "multi_thread")]
207+
#[tokio::test]
208208
async fn test_keyword_only() {
209209
const CODE: &str = "
210210
def foo(*, x: int) -> int:
@@ -226,7 +226,7 @@ def foo(*, x: int) -> int:
226226
);
227227
}
228228

229-
#[tokio::test(flavor = "multi_thread")]
229+
#[tokio::test]
230230
async fn test_var_keyword() {
231231
const CODE: &str = "
232232
def foo(**x: int) -> int:

host/tests/integration_tests/python/examples.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use datafusion_expr::{
1313

1414
use crate::integration_tests::python::test_utils::python_scalar_udf;
1515

16-
#[tokio::test(flavor = "multi_thread")]
16+
#[tokio::test]
1717
async fn test_add_one() {
1818
const CODE: &str = "
1919
def add_one(x: int) -> int:
@@ -32,10 +32,9 @@ def add_one(x: int) -> int:
3232
udf.return_type(&[DataType::Int64]).unwrap(),
3333
DataType::Int64,
3434
);
35-
assert_eq!(
36-
udf.return_type(&[]).unwrap_err().to_string(),
37-
"Error during planning: `add_one` expects 1 parameters but got 0",
38-
);
35+
// Signature is exact, so it would have been cached;
36+
// thus - no error even with a wrong type of argument.
37+
assert_eq!(udf.return_type(&[]).unwrap(), DataType::Int64,);
3938

4039
// call with array
4140
let array = udf

host/tests/integration_tests/python/inspection/errors.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::integration_tests::python::test_utils::python_scalar_udfs;
22
use datafusion_common::DataFusionError;
33

4-
#[tokio::test(flavor = "multi_thread")]
4+
#[tokio::test]
55
async fn test_invalid_syntax() {
66
const CODE: &str = ")";
77

@@ -18,7 +18,7 @@ async fn test_invalid_syntax() {
1818
);
1919
}
2020

21-
#[tokio::test(flavor = "multi_thread")]
21+
#[tokio::test]
2222
async fn test_missing_return_type() {
2323
const CODE: &str = "
2424
def add_one(x: int):
@@ -43,7 +43,7 @@ def add_one(x: int):
4343
);
4444
}
4545

46-
#[tokio::test(flavor = "multi_thread")]
46+
#[tokio::test]
4747
async fn test_missing_arg_type() {
4848
const CODE: &str = "
4949
def add_one(x) -> int:
@@ -68,7 +68,7 @@ def add_one(x) -> int:
6868
);
6969
}
7070

71-
#[tokio::test(flavor = "multi_thread")]
71+
#[tokio::test]
7272
async fn test_union_type_2() {
7373
const CODE: &str = "
7474
def add_one(x: int | str) -> int:
@@ -93,7 +93,7 @@ def add_one(x: int | str) -> int:
9393
);
9494
}
9595

96-
#[tokio::test(flavor = "multi_thread")]
96+
#[tokio::test]
9797
async fn test_union_type_2_and_none() {
9898
const CODE: &str = "
9999
def add_one(x: int | str | None) -> int:
@@ -118,7 +118,7 @@ def add_one(x: int | str | None) -> int:
118118
);
119119
}
120120

121-
#[tokio::test(flavor = "multi_thread")]
121+
#[tokio::test]
122122
async fn test_union_type_2_identical() {
123123
const CODE: &str = "
124124
def add_one(x: int | str | int) -> int:
@@ -143,7 +143,7 @@ def add_one(x: int | str | int) -> int:
143143
);
144144
}
145145

146-
#[tokio::test(flavor = "multi_thread")]
146+
#[tokio::test]
147147
async fn test_union_type_2_identical_and_none() {
148148
const CODE: &str = "
149149
def add_one(x: int | None | str | int) -> int:
@@ -168,7 +168,7 @@ def add_one(x: int | None | str | int) -> int:
168168
);
169169
}
170170

171-
#[tokio::test(flavor = "multi_thread")]
171+
#[tokio::test]
172172
async fn test_union_type_3() {
173173
const CODE: &str = "
174174
def add_one(x: int | str | float) -> int:
@@ -193,7 +193,7 @@ def add_one(x: int | str | float) -> int:
193193
);
194194
}
195195

196-
#[tokio::test(flavor = "multi_thread")]
196+
#[tokio::test]
197197
async fn test_type_annotation_is_not_a_type() {
198198
const CODE: &str = "
199199
def add_one(x: 1337) -> int:
@@ -218,7 +218,7 @@ def add_one(x: 1337) -> int:
218218
);
219219
}
220220

221-
#[tokio::test(flavor = "multi_thread")]
221+
#[tokio::test]
222222
async fn test_unsupported_type() {
223223
const CODE: &str = "
224224
def add_one(x: list[int]) -> int:
@@ -243,7 +243,7 @@ def add_one(x: list[int]) -> int:
243243
);
244244
}
245245

246-
#[tokio::test(flavor = "multi_thread")]
246+
#[tokio::test]
247247
async fn test_custom_type() {
248248
const CODE: &str = "
249249
class C:
@@ -271,7 +271,7 @@ def add_one(x: C) -> int:
271271
);
272272
}
273273

274-
#[tokio::test(flavor = "multi_thread")]
274+
#[tokio::test]
275275
async fn test_exception() {
276276
const CODE: &str = "
277277
raise Exception('foo')

host/tests/integration_tests/python/inspection/filter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::integration_tests::python::test_utils::python_scalar_udfs;
22
use datafusion_expr::ScalarUDFImpl;
33

4-
#[tokio::test(flavor = "multi_thread")]
4+
#[tokio::test]
55
async fn test_underscore() {
66
const CODE: &str = "
77
def foo(x: int) -> int:
@@ -14,7 +14,7 @@ def _bar(x: int) -> int:
1414
assert_eq!(found_udfs(CODE).await, ["foo".to_owned()]);
1515
}
1616

17-
#[tokio::test(flavor = "multi_thread")]
17+
#[tokio::test]
1818
async fn test_non_callalbes() {
1919
const CODE: &str = "
2020
variable = 1
@@ -26,7 +26,7 @@ def foo(x: int) -> int:
2626
assert_eq!(found_udfs(CODE).await, ["foo".to_owned()]);
2727
}
2828

29-
#[tokio::test(flavor = "multi_thread")]
29+
#[tokio::test]
3030
async fn test_imports() {
3131
const CODE: &str = "
3232
from sys import exit
@@ -38,7 +38,7 @@ def foo(x: int) -> int:
3838
assert_eq!(found_udfs(CODE).await, ["foo".to_owned()]);
3939
}
4040

41-
#[tokio::test(flavor = "multi_thread")]
41+
#[tokio::test]
4242
async fn test_classes() {
4343
const CODE: &str = "
4444
class C:

host/tests/integration_tests/python/runtime/dependencies.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use datafusion_expr::{ColumnarValue, ScalarFunctionArgs, async_udf::AsyncScalarU
99

1010
use crate::integration_tests::python::test_utils::python_scalar_udf;
1111

12-
#[tokio::test(flavor = "multi_thread")]
12+
#[tokio::test]
1313
async fn call_other_function() {
1414
const CODE: &str = "
1515
def _sub1(x: int) -> int:
@@ -45,7 +45,7 @@ def foo(x: int) -> int:
4545
);
4646
}
4747

48-
#[tokio::test(flavor = "multi_thread")]
48+
#[tokio::test]
4949
async fn functools_cache() {
5050
const CODE: &str = "
5151
from functools import cache

host/tests/integration_tests/python/runtime/errors.rs

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use datafusion_expr::{
1212

1313
use crate::integration_tests::python::test_utils::python_scalar_udf;
1414

15-
#[tokio::test(flavor = "multi_thread")]
15+
#[tokio::test]
1616
async fn test_return_type_param_mismatch() {
1717
const CODE: &str = "
1818
def foo(x: int) -> int:
@@ -21,23 +21,15 @@ def foo(x: int) -> int:
2121

2222
let udf = python_scalar_udf(CODE).await.unwrap();
2323

24+
// Signature is exact, so it would have been cached;
25+
// thus - no error even with a wrong type of argument.
2426
insta::assert_snapshot!(
25-
udf.return_type(&[]).unwrap_err(),
26-
@"Error during planning: `foo` expects 1 parameters but got 0",
27-
);
28-
29-
insta::assert_snapshot!(
30-
udf.return_type(&[DataType::Int64, DataType::Int64]).unwrap_err(),
31-
@"Error during planning: `foo` expects 1 parameters but got 2",
32-
);
33-
34-
insta::assert_snapshot!(
35-
udf.return_type(&[DataType::Float64]).unwrap_err(),
36-
@"Error during planning: argument 1 of `foo` should be Int64, got Float64",
27+
udf.return_type(&[]).unwrap(),
28+
@"Int64",
3729
);
3830
}
3931

40-
#[tokio::test(flavor = "multi_thread")]
32+
#[tokio::test]
4133
async fn test_invoke_args_mismatch() {
4234
const CODE: &str = "
4335
def foo(x: int) -> int:
@@ -133,7 +125,7 @@ def foo(x: int) -> int:
133125
);
134126
}
135127

136-
#[tokio::test(flavor = "multi_thread")]
128+
#[tokio::test]
137129
async fn test_invoke_arg_fields_mismatch() {
138130
const CODE: &str = "
139131
def foo(x: int) -> int:
@@ -188,7 +180,7 @@ def foo(x: int) -> int:
188180
);
189181
}
190182

191-
#[tokio::test(flavor = "multi_thread")]
183+
#[tokio::test]
192184
async fn test_invoke_return_field_mismatch() {
193185
const CODE: &str = "
194186
def foo(x: int) -> int:
@@ -226,7 +218,7 @@ def foo(x: int) -> int:
226218
);
227219
}
228220

229-
#[tokio::test(flavor = "multi_thread")]
221+
#[tokio::test]
230222
async fn test_should_not_return_none() {
231223
const CODE: &str = "
232224
def foo(x: int) -> int:
@@ -239,7 +231,7 @@ def foo(x: int) -> int:
239231
);
240232
}
241233

242-
#[tokio::test(flavor = "multi_thread")]
234+
#[tokio::test]
243235
async fn test_exception_direct() {
244236
const CODE: &str = "
245237
def foo(x: int) -> int:
@@ -258,7 +250,7 @@ def foo(x: int) -> int:
258250
);
259251
}
260252

261-
#[tokio::test(flavor = "multi_thread")]
253+
#[tokio::test]
262254
async fn test_exception_indirect() {
263255
const CODE: &str = "
264256
def _inner1() -> None:
@@ -308,7 +300,7 @@ def foo(x: int) -> int:
308300
);
309301
}
310302

311-
#[tokio::test(flavor = "multi_thread")]
303+
#[tokio::test]
312304
async fn test_stack_overflow() {
313305
// borrowed from https://wiki.python.org/moin/CrashingPython
314306
const CODE: &str = "

host/tests/integration_tests/python/runtime/fs.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use tokio::runtime::Handle;
1111

1212
use crate::integration_tests::python::test_utils::{python_component, python_scalar_udf};
1313

14-
#[tokio::test(flavor = "multi_thread")]
14+
#[tokio::test]
1515
async fn test_listdir() {
1616
const CODE: &str = r#"
1717
import os
@@ -110,7 +110,7 @@ def listdir(cwd: str | None, dir: str) -> str:
110110
);
111111
}
112112

113-
#[tokio::test(flavor = "multi_thread")]
113+
#[tokio::test]
114114
async fn test_read() {
115115
const CODE: &str = r#"
116116
def read(path: str) -> str:
@@ -181,7 +181,7 @@ if __name__ == '__main__':
181181
);
182182
}
183183

184-
#[tokio::test(flavor = "multi_thread")]
184+
#[tokio::test]
185185
async fn test_write() {
186186
const CODE: &str = r#"
187187
def write(path: str) -> str:
@@ -236,7 +236,7 @@ def write(path: str) -> str:
236236
);
237237
}
238238

239-
#[tokio::test(flavor = "multi_thread")]
239+
#[tokio::test]
240240
async fn test_limit_inodes() {
241241
let component = python_component().await;
242242

@@ -258,7 +258,7 @@ async fn test_limit_inodes() {
258258
@"IO error: inodes limit reached: limit<=42 current==42 requested+=1");
259259
}
260260

261-
#[tokio::test(flavor = "multi_thread")]
261+
#[tokio::test]
262262
async fn test_limit_bytes() {
263263
let component = python_component().await;
264264

0 commit comments

Comments
 (0)