|
30 | 30 | bind_kv_cache, |
31 | 31 | common_broadcastable_dtype, |
32 | 32 | current_stream, |
33 | | - deprecate_kwargs, |
34 | 33 | get_open_port, |
35 | 34 | get_tcp_uri, |
36 | 35 | is_lossless_cast, |
|
42 | 41 | sha256, |
43 | 42 | split_host_port, |
44 | 43 | split_zmq_path, |
45 | | - supports_kw, |
46 | 44 | swap_dict_values, |
47 | 45 | unique_filepath, |
48 | 46 | ) |
49 | 47 |
|
50 | | -from ..utils import create_new_process_for_each_test, error_on_warning |
| 48 | +from ..utils import create_new_process_for_each_test |
51 | 49 |
|
52 | 50 |
|
53 | 51 | @pytest.mark.asyncio |
@@ -83,61 +81,6 @@ async def stream_output(generator: AsyncIterator[tuple[int, str]]): |
83 | 81 | raise AssertionError() from e |
84 | 82 |
|
85 | 83 |
|
86 | | -def test_deprecate_kwargs_always(): |
87 | | - @deprecate_kwargs("old_arg", is_deprecated=True) |
88 | | - def dummy(*, old_arg: object = None, new_arg: object = None): |
89 | | - pass |
90 | | - |
91 | | - with pytest.warns(DeprecationWarning, match="'old_arg'"): |
92 | | - dummy(old_arg=1) |
93 | | - |
94 | | - with error_on_warning(DeprecationWarning): |
95 | | - dummy(new_arg=1) |
96 | | - |
97 | | - |
98 | | -def test_deprecate_kwargs_never(): |
99 | | - @deprecate_kwargs("old_arg", is_deprecated=False) |
100 | | - def dummy(*, old_arg: object = None, new_arg: object = None): |
101 | | - pass |
102 | | - |
103 | | - with error_on_warning(DeprecationWarning): |
104 | | - dummy(old_arg=1) |
105 | | - |
106 | | - with error_on_warning(DeprecationWarning): |
107 | | - dummy(new_arg=1) |
108 | | - |
109 | | - |
110 | | -def test_deprecate_kwargs_dynamic(): |
111 | | - is_deprecated = True |
112 | | - |
113 | | - @deprecate_kwargs("old_arg", is_deprecated=lambda: is_deprecated) |
114 | | - def dummy(*, old_arg: object = None, new_arg: object = None): |
115 | | - pass |
116 | | - |
117 | | - with pytest.warns(DeprecationWarning, match="'old_arg'"): |
118 | | - dummy(old_arg=1) |
119 | | - |
120 | | - with error_on_warning(DeprecationWarning): |
121 | | - dummy(new_arg=1) |
122 | | - |
123 | | - is_deprecated = False |
124 | | - |
125 | | - with error_on_warning(DeprecationWarning): |
126 | | - dummy(old_arg=1) |
127 | | - |
128 | | - with error_on_warning(DeprecationWarning): |
129 | | - dummy(new_arg=1) |
130 | | - |
131 | | - |
132 | | -def test_deprecate_kwargs_additional_message(): |
133 | | - @deprecate_kwargs("old_arg", is_deprecated=True, additional_message="abcd") |
134 | | - def dummy(*, old_arg: object = None, new_arg: object = None): |
135 | | - pass |
136 | | - |
137 | | - with pytest.warns(DeprecationWarning, match="abcd"): |
138 | | - dummy(old_arg=1) |
139 | | - |
140 | | - |
141 | 84 | def test_get_open_port(monkeypatch: pytest.MonkeyPatch): |
142 | 85 | with monkeypatch.context() as m: |
143 | 86 | m.setenv("VLLM_PORT", "5678") |
@@ -383,39 +326,6 @@ def test_duplicate_dict_args(caplog_vllm, parser): |
383 | 326 | assert "-O.mode" in caplog_vllm.text |
384 | 327 |
|
385 | 328 |
|
386 | | -@pytest.mark.parametrize( |
387 | | - "callable,kw_name,requires_kw_only,allow_var_kwargs,is_supported", |
388 | | - [ |
389 | | - # Tests for positional argument support |
390 | | - (lambda foo: None, "foo", True, True, False), |
391 | | - (lambda foo: None, "foo", False, True, True), |
392 | | - # Tests for positional or keyword / keyword only |
393 | | - (lambda foo=100: None, "foo", True, True, False), |
394 | | - (lambda *, foo: None, "foo", False, True, True), |
395 | | - # Tests to make sure the names of variadic params are NOT supported |
396 | | - (lambda *args: None, "args", False, True, False), |
397 | | - (lambda **kwargs: None, "kwargs", False, True, False), |
398 | | - # Tests for if we allow var kwargs to add support |
399 | | - (lambda foo: None, "something_else", False, True, False), |
400 | | - (lambda foo, **kwargs: None, "something_else", False, True, True), |
401 | | - (lambda foo, **kwargs: None, "kwargs", True, True, False), |
402 | | - (lambda foo, **kwargs: None, "foo", True, True, False), |
403 | | - ], |
404 | | -) |
405 | | -def test_supports_kw( |
406 | | - callable, kw_name, requires_kw_only, allow_var_kwargs, is_supported |
407 | | -): |
408 | | - assert ( |
409 | | - supports_kw( |
410 | | - callable=callable, |
411 | | - kw_name=kw_name, |
412 | | - requires_kw_only=requires_kw_only, |
413 | | - allow_var_kwargs=allow_var_kwargs, |
414 | | - ) |
415 | | - == is_supported |
416 | | - ) |
417 | | - |
418 | | - |
419 | 329 | @create_new_process_for_each_test() |
420 | 330 | def test_memory_profiling(): |
421 | 331 | # Fake out some model loading + inference memory usage to test profiling |
@@ -863,36 +773,6 @@ def test_join_host_port(): |
863 | 773 | assert join_host_port("::1", 5555) == "[::1]:5555" |
864 | 774 |
|
865 | 775 |
|
866 | | -def test_json_count_leaves(): |
867 | | - """Test json_count_leaves function from jsontree utility.""" |
868 | | - from vllm.utils.jsontree import json_count_leaves |
869 | | - |
870 | | - # Single leaf values |
871 | | - assert json_count_leaves(42) == 1 |
872 | | - assert json_count_leaves("hello") == 1 |
873 | | - assert json_count_leaves(None) == 1 |
874 | | - |
875 | | - # Empty containers |
876 | | - assert json_count_leaves([]) == 0 |
877 | | - assert json_count_leaves({}) == 0 |
878 | | - assert json_count_leaves(()) == 0 |
879 | | - |
880 | | - # Flat structures |
881 | | - assert json_count_leaves([1, 2, 3]) == 3 |
882 | | - assert json_count_leaves({"a": 1, "b": 2}) == 2 |
883 | | - assert json_count_leaves((1, 2, 3)) == 3 |
884 | | - |
885 | | - # Nested structures |
886 | | - nested_dict = {"a": 1, "b": {"c": 2, "d": 3}} |
887 | | - assert json_count_leaves(nested_dict) == 3 |
888 | | - |
889 | | - nested_list = [1, [2, 3], 4] |
890 | | - assert json_count_leaves(nested_list) == 4 |
891 | | - |
892 | | - mixed_nested = {"list": [1, 2], "dict": {"x": 3}, "value": 4} |
893 | | - assert json_count_leaves(mixed_nested) == 4 |
894 | | - |
895 | | - |
896 | 776 | def test_convert_ids_list_to_tokens(): |
897 | 777 | tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct") |
898 | 778 | token_ids = tokenizer.encode("Hello, world!") |
|
0 commit comments