From c0f0bce15472b9601256e17fa966095d877dc8b7 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Wed, 20 Mar 2024 18:16:02 +0100 Subject: [PATCH 1/4] Update thrid party testing f/w --- tests/skipped_tests.tbl | 174 +++++----- tests/skipped_tests_gpu.tbl | 187 +++++----- .../cupy/binary_tests/test_elementwise.py | 1 - .../cupy/core_tests/test_ndarray_reduction.py | 3 +- .../cupy/creation_tests/test_basic.py | 2 - .../cupy/creation_tests/test_matrix.py | 3 - .../cupy/creation_tests/test_ranges.py | 4 - tests/third_party/cupy/fft_tests/test_fft.py | 9 - .../cupy/indexing_tests/test_generate.py | 7 - .../cupy/indexing_tests/test_indexing.py | 2 - .../cupy/indexing_tests/test_insert.py | 13 - .../cupy/indexing_tests/test_iterate.py | 3 - .../cupy/logic_tests/test_comparison.py | 2 - .../cupy/logic_tests/test_content.py | 1 - .../cupy/logic_tests/test_truth.py | 4 +- .../cupy/manipulation_tests/test_shape.py | 4 - .../cupy/manipulation_tests/test_tiling.py | 7 - .../cupy/manipulation_tests/test_transpose.py | 1 - .../cupy/math_tests/test_arithmetic.py | 7 +- .../cupy/math_tests/test_explog.py | 6 +- .../cupy/math_tests/test_floating.py | 1 - .../cupy/random_tests/test_distributions.py | 133 +++----- .../cupy/random_tests/test_sample.py | 20 +- .../cupy/sorting_tests/test_search.py | 24 +- .../cupy/sorting_tests/test_sort.py | 4 - .../cupy/statistics_tests/test_correlation.py | 4 - .../cupy/statistics_tests/test_histogram.py | 8 +- tests/third_party/cupy/testing/__init__.py | 61 ++-- .../cupy/testing/{array.py => _array.py} | 38 ++- tests/third_party/cupy/testing/_attr.py | 45 +++ tests/third_party/cupy/testing/_bundle.py | 77 +---- tests/third_party/cupy/testing/_helper.py | 320 ++++++++++++++++++ .../testing/{hypothesis.py => _hypothesis.py} | 0 .../cupy/testing/{helper.py => _loops.py} | 269 +-------------- .../cupy/testing/_parameterized.py | 119 +++++++ .../third_party/cupy/testing/_pytest_impl.py | 79 +++++ .../cupy/testing/{random.py => _random.py} | 6 +- tests/third_party/cupy/testing/attr.py | 75 ---- .../third_party/cupy/testing/parameterized.py | 167 --------- 39 files changed, 897 insertions(+), 993 deletions(-) rename tests/third_party/cupy/testing/{array.py => _array.py} (87%) create mode 100644 tests/third_party/cupy/testing/_attr.py create mode 100644 tests/third_party/cupy/testing/_helper.py rename tests/third_party/cupy/testing/{hypothesis.py => _hypothesis.py} (100%) rename tests/third_party/cupy/testing/{helper.py => _loops.py} (86%) create mode 100644 tests/third_party/cupy/testing/_parameterized.py create mode 100644 tests/third_party/cupy/testing/_pytest_impl.py rename tests/third_party/cupy/testing/{random.py => _random.py} (96%) delete mode 100644 tests/third_party/cupy/testing/attr.py delete mode 100644 tests/third_party/cupy/testing/parameterized.py diff --git a/tests/skipped_tests.tbl b/tests/skipped_tests.tbl index 182eaf8877a1..ffd34cbf47dd 100644 --- a/tests/skipped_tests.tbl +++ b/tests/skipped_tests.tbl @@ -386,12 +386,12 @@ tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_nan_to_num_inf_ar tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_nan_to_num_broadcast[nan] tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_nan_to_num_broadcast[posinf] tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_nan_to_num_broadcast[neginf] -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid_param_0_{mode='valid'}::test_convolve_empty -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid_param_0_{mode='valid'}::test_convolve_ndim -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid_param_1_{mode='same'}::test_convolve_empty -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid_param_1_{mode='same'}::test_convolve_ndim -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid_param_2_{mode='full'}::test_convolve_empty -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid_param_2_{mode='full'}::test_convolve_ndim +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid::test_convolve_empty[_param_0_{mode='valid'}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid::test_convolve_empty[_param_1_{mode='same'}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid::test_convolve_empty[_param_2_{mode='full'}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid::test_convolve_ndim[_param_0_{mode='valid'}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid::test_convolve_ndim[_param_1_{mode='same'}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid::test_convolve_ndim[_param_2_{mode='full'}] tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_fabs tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_fabs_negative @@ -419,81 +419,81 @@ tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_interp_size1 tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_interp_inf_to_nan tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_heaviside tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_heaviside_nan_inf -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_0_{mode='valid', shape1=(), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_1_{mode='valid', shape1=(), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_2_{mode='valid', shape1=(), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_3_{mode='valid', shape1=(), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_4_{mode='valid', shape1=(), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_5_{mode='valid', shape1=(5,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_6_{mode='valid', shape1=(5,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_7_{mode='valid', shape1=(5,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_8_{mode='valid', shape1=(5,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_9_{mode='valid', shape1=(5,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_10_{mode='valid', shape1=(6,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_11_{mode='valid', shape1=(6,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_12_{mode='valid', shape1=(6,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_13_{mode='valid', shape1=(6,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_14_{mode='valid', shape1=(6,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_15_{mode='valid', shape1=(20,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_16_{mode='valid', shape1=(20,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_17_{mode='valid', shape1=(20,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_18_{mode='valid', shape1=(20,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_19_{mode='valid', shape1=(20,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_20_{mode='valid', shape1=(21,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_21_{mode='valid', shape1=(21,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_22_{mode='valid', shape1=(21,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_23_{mode='valid', shape1=(21,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_24_{mode='valid', shape1=(21,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_25_{mode='same', shape1=(), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_26_{mode='same', shape1=(), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_27_{mode='same', shape1=(), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_28_{mode='same', shape1=(), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_29_{mode='same', shape1=(), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_30_{mode='same', shape1=(5,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_31_{mode='same', shape1=(5,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_32_{mode='same', shape1=(5,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_33_{mode='same', shape1=(5,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_34_{mode='same', shape1=(5,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_35_{mode='same', shape1=(6,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_36_{mode='same', shape1=(6,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_37_{mode='same', shape1=(6,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_38_{mode='same', shape1=(6,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_39_{mode='same', shape1=(6,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_40_{mode='same', shape1=(20,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_41_{mode='same', shape1=(20,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_42_{mode='same', shape1=(20,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_43_{mode='same', shape1=(20,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_44_{mode='same', shape1=(20,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_45_{mode='same', shape1=(21,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_46_{mode='same', shape1=(21,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_47_{mode='same', shape1=(21,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_48_{mode='same', shape1=(21,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_49_{mode='same', shape1=(21,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_50_{mode='full', shape1=(), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_51_{mode='full', shape1=(), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_52_{mode='full', shape1=(), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_53_{mode='full', shape1=(), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_54_{mode='full', shape1=(), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_55_{mode='full', shape1=(5,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_56_{mode='full', shape1=(5,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_57_{mode='full', shape1=(5,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_58_{mode='full', shape1=(5,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_59_{mode='full', shape1=(5,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_60_{mode='full', shape1=(6,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_61_{mode='full', shape1=(6,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_62_{mode='full', shape1=(6,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_63_{mode='full', shape1=(6,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_64_{mode='full', shape1=(6,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_65_{mode='full', shape1=(20,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_66_{mode='full', shape1=(20,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_67_{mode='full', shape1=(20,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_68_{mode='full', shape1=(20,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_69_{mode='full', shape1=(20,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_70_{mode='full', shape1=(21,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_71_{mode='full', shape1=(21,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_72_{mode='full', shape1=(21,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_73_{mode='full', shape1=(21,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_74_{mode='full', shape1=(21,), shape2=(21,)}::test_convolve +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_0_{mode='valid', shape1=(), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_1_{mode='valid', shape1=(), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_2_{mode='valid', shape1=(), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_3_{mode='valid', shape1=(), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_4_{mode='valid', shape1=(), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_5_{mode='valid', shape1=(5,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_6_{mode='valid', shape1=(5,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_7_{mode='valid', shape1=(5,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_8_{mode='valid', shape1=(5,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_9_{mode='valid', shape1=(5,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_10_{mode='valid', shape1=(6,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_11_{mode='valid', shape1=(6,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_12_{mode='valid', shape1=(6,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_13_{mode='valid', shape1=(6,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_14_{mode='valid', shape1=(6,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_15_{mode='valid', shape1=(20,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_16_{mode='valid', shape1=(20,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_17_{mode='valid', shape1=(20,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_18_{mode='valid', shape1=(20,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_19_{mode='valid', shape1=(20,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_20_{mode='valid', shape1=(21,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_21_{mode='valid', shape1=(21,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_22_{mode='valid', shape1=(21,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_23_{mode='valid', shape1=(21,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_24_{mode='valid', shape1=(21,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_25_{mode='same', shape1=(), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_26_{mode='same', shape1=(), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_27_{mode='same', shape1=(), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_28_{mode='same', shape1=(), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_29_{mode='same', shape1=(), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_30_{mode='same', shape1=(5,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_31_{mode='same', shape1=(5,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_32_{mode='same', shape1=(5,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_33_{mode='same', shape1=(5,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_34_{mode='same', shape1=(5,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_35_{mode='same', shape1=(6,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_36_{mode='same', shape1=(6,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_37_{mode='same', shape1=(6,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_38_{mode='same', shape1=(6,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_39_{mode='same', shape1=(6,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_40_{mode='same', shape1=(20,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_41_{mode='same', shape1=(20,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_42_{mode='same', shape1=(20,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_43_{mode='same', shape1=(20,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_44_{mode='same', shape1=(20,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_45_{mode='same', shape1=(21,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_46_{mode='same', shape1=(21,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_47_{mode='same', shape1=(21,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_48_{mode='same', shape1=(21,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_49_{mode='same', shape1=(21,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_50_{mode='full', shape1=(), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_51_{mode='full', shape1=(), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_52_{mode='full', shape1=(), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_53_{mode='full', shape1=(), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_54_{mode='full', shape1=(), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_55_{mode='full', shape1=(5,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_56_{mode='full', shape1=(5,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_57_{mode='full', shape1=(5,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_58_{mode='full', shape1=(5,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_59_{mode='full', shape1=(5,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_60_{mode='full', shape1=(6,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_61_{mode='full', shape1=(6,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_62_{mode='full', shape1=(6,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_63_{mode='full', shape1=(6,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_64_{mode='full', shape1=(6,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_65_{mode='full', shape1=(20,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_66_{mode='full', shape1=(20,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_67_{mode='full', shape1=(20,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_68_{mode='full', shape1=(20,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_69_{mode='full', shape1=(20,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_70_{mode='full', shape1=(21,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_71_{mode='full', shape1=(21,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_72_{mode='full', shape1=(21,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_73_{mode='full', shape1=(21,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_74_{mode='full', shape1=(21,), shape2=(21,)}] tests/third_party/cupy/math_tests/test_misc.py::TestConvolve::test_convolve_non_contiguous[valid] tests/third_party/cupy/math_tests/test_misc.py::TestConvolve::test_convolve_non_contiguous[same] tests/third_party/cupy/math_tests/test_misc.py::TestConvolve::test_convolve_non_contiguous[full] @@ -514,12 +514,12 @@ tests/third_party/cupy/math_tests/test_sumprod.py::TestCumprod::test_cumprod_out tests/third_party/cupy/math_tests/test_sumprod.py::TestCumprod::test_cumprod_1dim tests/third_party/cupy/math_tests/test_sumprod.py::TestCumprod::test_cumprod_2dim_without_axis -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_0_{axis=0}::test_cumsum_arraylike -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_0_{axis=0}::test_cumsum_numpy_array -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_1_{axis=1}::test_cumsum_arraylike -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_1_{axis=1}::test_cumsum_numpy_array -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_2_{axis=2}::test_cumsum_arraylike -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_2_{axis=2}::test_cumsum_numpy_array +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_arraylike[_param_0_{axis=0}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_arraylike[_param_1_{axis=1}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_arraylike[_param_2_{axis=2}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_numpy_array[_param_0_{axis=0}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_numpy_array[_param_1_{axis=1}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_numpy_array[_param_2_{axis=2}] tests/third_party/cupy/math_tests/test_trigonometric.py::TestUnwrap::test_unwrap_1dim tests/third_party/cupy/math_tests/test_trigonometric.py::TestUnwrap::test_unwrap_1dim_with_discont diff --git a/tests/skipped_tests_gpu.tbl b/tests/skipped_tests_gpu.tbl index d6fd43e18877..436496bfc196 100644 --- a/tests/skipped_tests_gpu.tbl +++ b/tests/skipped_tests_gpu.tbl @@ -482,12 +482,12 @@ tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_nan_to_num_inf_ar tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_nan_to_num_broadcast[nan] tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_nan_to_num_broadcast[posinf] tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_nan_to_num_broadcast[neginf] -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid_param_0_{mode='valid'}::test_convolve_empty -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid_param_0_{mode='valid'}::test_convolve_ndim -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid_param_1_{mode='same'}::test_convolve_empty -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid_param_1_{mode='same'}::test_convolve_ndim -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid_param_2_{mode='full'}::test_convolve_empty -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid_param_2_{mode='full'}::test_convolve_ndim +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid::test_convolve_empty[_param_0_{mode='valid'}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid::test_convolve_empty[_param_1_{mode='same'}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid::test_convolve_empty[_param_2_{mode='full'}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid::test_convolve_ndim[_param_0_{mode='valid'}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid::test_convolve_ndim[_param_1_{mode='same'}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveInvalid::test_convolve_ndim[_param_2_{mode='full'}] tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_fabs @@ -516,81 +516,81 @@ tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_interp_size1 tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_interp_inf_to_nan tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_heaviside tests/third_party/cupy/math_tests/test_misc.py::TestMisc::test_heaviside_nan_inf -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_0_{mode='valid', shape1=(), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_1_{mode='valid', shape1=(), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_2_{mode='valid', shape1=(), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_3_{mode='valid', shape1=(), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_4_{mode='valid', shape1=(), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_5_{mode='valid', shape1=(5,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_6_{mode='valid', shape1=(5,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_7_{mode='valid', shape1=(5,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_8_{mode='valid', shape1=(5,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_9_{mode='valid', shape1=(5,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_10_{mode='valid', shape1=(6,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_11_{mode='valid', shape1=(6,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_12_{mode='valid', shape1=(6,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_13_{mode='valid', shape1=(6,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_14_{mode='valid', shape1=(6,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_15_{mode='valid', shape1=(20,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_16_{mode='valid', shape1=(20,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_17_{mode='valid', shape1=(20,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_18_{mode='valid', shape1=(20,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_19_{mode='valid', shape1=(20,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_20_{mode='valid', shape1=(21,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_21_{mode='valid', shape1=(21,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_22_{mode='valid', shape1=(21,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_23_{mode='valid', shape1=(21,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_24_{mode='valid', shape1=(21,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_25_{mode='same', shape1=(), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_26_{mode='same', shape1=(), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_27_{mode='same', shape1=(), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_28_{mode='same', shape1=(), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_29_{mode='same', shape1=(), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_30_{mode='same', shape1=(5,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_31_{mode='same', shape1=(5,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_32_{mode='same', shape1=(5,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_33_{mode='same', shape1=(5,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_34_{mode='same', shape1=(5,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_35_{mode='same', shape1=(6,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_36_{mode='same', shape1=(6,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_37_{mode='same', shape1=(6,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_38_{mode='same', shape1=(6,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_39_{mode='same', shape1=(6,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_40_{mode='same', shape1=(20,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_41_{mode='same', shape1=(20,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_42_{mode='same', shape1=(20,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_43_{mode='same', shape1=(20,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_44_{mode='same', shape1=(20,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_45_{mode='same', shape1=(21,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_46_{mode='same', shape1=(21,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_47_{mode='same', shape1=(21,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_48_{mode='same', shape1=(21,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_49_{mode='same', shape1=(21,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_50_{mode='full', shape1=(), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_51_{mode='full', shape1=(), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_52_{mode='full', shape1=(), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_53_{mode='full', shape1=(), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_54_{mode='full', shape1=(), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_55_{mode='full', shape1=(5,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_56_{mode='full', shape1=(5,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_57_{mode='full', shape1=(5,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_58_{mode='full', shape1=(5,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_59_{mode='full', shape1=(5,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_60_{mode='full', shape1=(6,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_61_{mode='full', shape1=(6,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_62_{mode='full', shape1=(6,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_63_{mode='full', shape1=(6,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_64_{mode='full', shape1=(6,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_65_{mode='full', shape1=(20,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_66_{mode='full', shape1=(20,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_67_{mode='full', shape1=(20,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_68_{mode='full', shape1=(20,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_69_{mode='full', shape1=(20,), shape2=(21,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_70_{mode='full', shape1=(21,), shape2=()}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_71_{mode='full', shape1=(21,), shape2=(5,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_72_{mode='full', shape1=(21,), shape2=(6,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_73_{mode='full', shape1=(21,), shape2=(20,)}::test_convolve -tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination_param_74_{mode='full', shape1=(21,), shape2=(21,)}::test_convolve +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_0_{mode='valid', shape1=(), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_1_{mode='valid', shape1=(), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_2_{mode='valid', shape1=(), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_3_{mode='valid', shape1=(), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_4_{mode='valid', shape1=(), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_5_{mode='valid', shape1=(5,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_6_{mode='valid', shape1=(5,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_7_{mode='valid', shape1=(5,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_8_{mode='valid', shape1=(5,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_9_{mode='valid', shape1=(5,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_10_{mode='valid', shape1=(6,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_11_{mode='valid', shape1=(6,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_12_{mode='valid', shape1=(6,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_13_{mode='valid', shape1=(6,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_14_{mode='valid', shape1=(6,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_15_{mode='valid', shape1=(20,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_16_{mode='valid', shape1=(20,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_17_{mode='valid', shape1=(20,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_18_{mode='valid', shape1=(20,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_19_{mode='valid', shape1=(20,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_20_{mode='valid', shape1=(21,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_21_{mode='valid', shape1=(21,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_22_{mode='valid', shape1=(21,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_23_{mode='valid', shape1=(21,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_24_{mode='valid', shape1=(21,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_25_{mode='same', shape1=(), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_26_{mode='same', shape1=(), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_27_{mode='same', shape1=(), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_28_{mode='same', shape1=(), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_29_{mode='same', shape1=(), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_30_{mode='same', shape1=(5,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_31_{mode='same', shape1=(5,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_32_{mode='same', shape1=(5,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_33_{mode='same', shape1=(5,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_34_{mode='same', shape1=(5,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_35_{mode='same', shape1=(6,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_36_{mode='same', shape1=(6,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_37_{mode='same', shape1=(6,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_38_{mode='same', shape1=(6,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_39_{mode='same', shape1=(6,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_40_{mode='same', shape1=(20,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_41_{mode='same', shape1=(20,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_42_{mode='same', shape1=(20,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_43_{mode='same', shape1=(20,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_44_{mode='same', shape1=(20,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_45_{mode='same', shape1=(21,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_46_{mode='same', shape1=(21,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_47_{mode='same', shape1=(21,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_48_{mode='same', shape1=(21,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_49_{mode='same', shape1=(21,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_50_{mode='full', shape1=(), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_51_{mode='full', shape1=(), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_52_{mode='full', shape1=(), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_53_{mode='full', shape1=(), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_54_{mode='full', shape1=(), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_55_{mode='full', shape1=(5,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_56_{mode='full', shape1=(5,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_57_{mode='full', shape1=(5,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_58_{mode='full', shape1=(5,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_59_{mode='full', shape1=(5,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_60_{mode='full', shape1=(6,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_61_{mode='full', shape1=(6,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_62_{mode='full', shape1=(6,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_63_{mode='full', shape1=(6,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_64_{mode='full', shape1=(6,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_65_{mode='full', shape1=(20,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_66_{mode='full', shape1=(20,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_67_{mode='full', shape1=(20,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_68_{mode='full', shape1=(20,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_69_{mode='full', shape1=(20,), shape2=(21,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_70_{mode='full', shape1=(21,), shape2=()}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_71_{mode='full', shape1=(21,), shape2=(5,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_72_{mode='full', shape1=(21,), shape2=(6,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_73_{mode='full', shape1=(21,), shape2=(20,)}] +tests/third_party/cupy/math_tests/test_misc.py::TestConvolveShapeCombination::test_convolve[_param_74_{mode='full', shape1=(21,), shape2=(21,)}] tests/third_party/cupy/math_tests/test_misc.py::TestConvolve::test_convolve_non_contiguous[valid] tests/third_party/cupy/math_tests/test_misc.py::TestConvolve::test_convolve_non_contiguous[same] tests/third_party/cupy/math_tests/test_misc.py::TestConvolve::test_convolve_non_contiguous[full] @@ -611,18 +611,19 @@ tests/third_party/cupy/math_tests/test_sumprod.py::TestCumprod::test_cumprod_out tests/third_party/cupy/math_tests/test_sumprod.py::TestCumprod::test_cumprod_1dim tests/third_party/cupy/math_tests/test_sumprod.py::TestCumprod::test_cumprod_2dim_without_axis -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_0_{axis=0}::test_cumsum -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_0_{axis=0}::test_cumsum_2dim -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_1_{axis=1}::test_cumsum -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_1_{axis=1}::test_cumsum_2dim -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_2_{axis=2}::test_cumsum -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_2_{axis=2}::test_cumsum_2dim -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_0_{axis=0}::test_cumsum_arraylike -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_0_{axis=0}::test_cumsum_numpy_array -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_1_{axis=1}::test_cumsum_arraylike -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_1_{axis=1}::test_cumsum_numpy_array -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_2_{axis=2}::test_cumsum_arraylike -tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum_param_2_{axis=2}::test_cumsum_numpy_array +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum[_param_0_{axis=0}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum[_param_1_{axis=1}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum[_param_2_{axis=2}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_2dim[_param_0_{axis=0}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_2dim[_param_1_{axis=1}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_2dim[_param_2_{axis=2}] + +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_arraylike[_param_0_{axis=0}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_arraylike[_param_1_{axis=1}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_arraylike[_param_2_{axis=2}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_numpy_array[_param_0_{axis=0}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_numpy_array[_param_1_{axis=1}] +tests/third_party/cupy/math_tests/test_sumprod.py::TestCumsum::test_cumsum_numpy_array[_param_2_{axis=2}] tests/third_party/cupy/math_tests/test_trigonometric.py::TestUnwrap::test_unwrap_1dim tests/third_party/cupy/math_tests/test_trigonometric.py::TestUnwrap::test_unwrap_1dim_with_discont diff --git a/tests/third_party/cupy/binary_tests/test_elementwise.py b/tests/third_party/cupy/binary_tests/test_elementwise.py index 3d69999b0b9a..a26983662566 100644 --- a/tests/third_party/cupy/binary_tests/test_elementwise.py +++ b/tests/third_party/cupy/binary_tests/test_elementwise.py @@ -3,7 +3,6 @@ from tests.third_party.cupy import testing -@testing.gpu class TestElementwise(unittest.TestCase): @testing.for_int_dtypes() @testing.numpy_cupy_array_equal() diff --git a/tests/third_party/cupy/core_tests/test_ndarray_reduction.py b/tests/third_party/cupy/core_tests/test_ndarray_reduction.py index 70d654d6a694..c0e344b3a7ca 100644 --- a/tests/third_party/cupy/core_tests/test_ndarray_reduction.py +++ b/tests/third_party/cupy/core_tests/test_ndarray_reduction.py @@ -9,7 +9,6 @@ from tests.third_party.cupy import testing -@testing.gpu @testing.parameterize( *testing.product( { @@ -395,7 +394,7 @@ def test_zero_size(self, xp): } ) ) -@testing.gpu + # @unittest.skipUnless(cupy.cuda.cub.available, 'The CUB routine is not enabled') class TestCubReduction(unittest.TestCase): # def setUp(self): diff --git a/tests/third_party/cupy/creation_tests/test_basic.py b/tests/third_party/cupy/creation_tests/test_basic.py index f7b8e62488a7..f2fe44b9facd 100644 --- a/tests/third_party/cupy/creation_tests/test_basic.py +++ b/tests/third_party/cupy/creation_tests/test_basic.py @@ -7,7 +7,6 @@ from tests.third_party.cupy import testing -@testing.gpu class TestBasic(unittest.TestCase): @testing.for_CF_orders() @testing.for_all_dtypes() @@ -259,7 +258,6 @@ def test_full_like_subok(self): } ) ) -@testing.gpu class TestBasicReshape(unittest.TestCase): @testing.with_requires("numpy>=1.17.0") @testing.for_orders("C") diff --git a/tests/third_party/cupy/creation_tests/test_matrix.py b/tests/third_party/cupy/creation_tests/test_matrix.py index 48f5c5b230b5..d803c6e28501 100644 --- a/tests/third_party/cupy/creation_tests/test_matrix.py +++ b/tests/third_party/cupy/creation_tests/test_matrix.py @@ -7,7 +7,6 @@ from tests.third_party.cupy import testing -@testing.gpu class TestMatrix(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_diag1(self, xp): @@ -107,7 +106,6 @@ def test_diagflat_from_scalar_with_k1(self, xp): {"shape": (3, 3)}, {"shape": (4, 3)}, ) -@testing.gpu class TestTri(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() @@ -131,7 +129,6 @@ def test_tri_posi(self, xp, dtype): {"shape": (4, 3)}, {"shape": (2, 3, 4)}, ) -@testing.gpu class TestTriLowerAndUpper(unittest.TestCase): @testing.for_all_dtypes(no_complex=True) @testing.numpy_cupy_array_equal() diff --git a/tests/third_party/cupy/creation_tests/test_ranges.py b/tests/third_party/cupy/creation_tests/test_ranges.py index 83170cb3e37f..2094f2ffc8e1 100644 --- a/tests/third_party/cupy/creation_tests/test_ranges.py +++ b/tests/third_party/cupy/creation_tests/test_ranges.py @@ -32,7 +32,6 @@ def wrapper(self, *args, **kwargs): return decorator -@testing.gpu class TestRanges(unittest.TestCase): @testing.for_all_dtypes(no_bool=True) @testing.numpy_cupy_array_equal() @@ -312,7 +311,6 @@ def test_logspace_array_start_stop_axis1(self, xp, dtype_range, dtype_out): } ) ) -@testing.gpu class TestMeshgrid(unittest.TestCase): @testing.for_all_dtypes() def test_meshgrid0(self, dtype): @@ -349,7 +347,6 @@ def test_meshgrid3(self, xp, dtype): ) -@testing.gpu class TestMgrid(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_mgrid0(self, xp): @@ -382,7 +379,6 @@ def test_mgrid5(self, xp): return xp.mgrid[x:y:10j, x:y:10j] -@testing.gpu class TestOgrid(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_ogrid0(self, xp): diff --git a/tests/third_party/cupy/fft_tests/test_fft.py b/tests/third_party/cupy/fft_tests/test_fft.py index 98c4ad29288a..4822c5bde87f 100644 --- a/tests/third_party/cupy/fft_tests/test_fft.py +++ b/tests/third_party/cupy/fft_tests/test_fft.py @@ -20,7 +20,6 @@ ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestFft(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_allclose( @@ -77,7 +76,6 @@ def test_ifft(self, xp, dtype): {"shape": (3, 4), "s": (1, 0), "axes": None, "norm": None}, ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestFft2(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_allclose( @@ -135,7 +133,6 @@ def test_ifft2(self, xp, dtype): {"shape": (0, 0, 5), "s": None, "axes": None, "norm": None}, ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestFftn(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_allclose( @@ -176,7 +173,6 @@ def test_ifftn(self, xp, dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestRfft(unittest.TestCase): @testing.for_all_dtypes(no_complex=True) @testing.numpy_cupy_allclose( @@ -208,7 +204,6 @@ def test_irfft(self, xp, dtype): {"shape": (2, 3, 4), "s": None, "axes": (), "norm": None}, ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestRfft2EmptyAxes(unittest.TestCase): @testing.for_all_dtypes(no_complex=True) def test_rfft2(self, dtype): @@ -230,7 +225,6 @@ def test_irfft2(self, dtype): {"shape": (2, 3, 4), "s": None, "axes": (), "norm": None}, ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestRfftnEmptyAxes(unittest.TestCase): @testing.for_all_dtypes(no_complex=True) def test_rfftn(self, dtype): @@ -257,7 +251,6 @@ def test_irfftn(self, dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestHfft(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_allclose( @@ -290,7 +283,6 @@ def test_ihfft(self, xp, dtype): {"n": 100, "d": 2}, ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestFftfreq(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_allclose( @@ -325,7 +317,6 @@ def test_rfftfreq(self, xp, dtype): {"shape": (10, 10), "axes": (0, 1)}, ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestFftshift(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_allclose( diff --git a/tests/third_party/cupy/indexing_tests/test_generate.py b/tests/third_party/cupy/indexing_tests/test_generate.py index dbec17358b2d..71aa1aa652e2 100644 --- a/tests/third_party/cupy/indexing_tests/test_generate.py +++ b/tests/third_party/cupy/indexing_tests/test_generate.py @@ -7,7 +7,6 @@ from tests.third_party.cupy import testing -@testing.gpu class TestIndices(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() @@ -30,7 +29,6 @@ def test_indices_list3(self): xp.indices((1, 2, 3, 4), dtype=xp.bool_) -@testing.gpu class TestIX_(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_ix_list(self, xp): @@ -50,7 +48,6 @@ def test_ix_bool_ndarray(self, xp): return xp.ix_(xp.array([True, False] * 2)) -@testing.gpu class TestR_(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() @@ -103,7 +100,6 @@ def test_r_9(self, dtype): cupy.r_[a, b] -@testing.gpu class TestC_(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() @@ -128,7 +124,6 @@ def test_c_3(self, dtype): cupy.c_[a, b] -@testing.gpu class TestAxisConcatenator(unittest.TestCase): def test_AxisConcatenator_init1(self): with self.assertRaises(TypeError): @@ -139,7 +134,6 @@ def test_len(self): self.assertEqual(len(a), 0) -@testing.gpu class TestUnravelIndex(unittest.TestCase): @testing.for_orders(["C", "F", None]) @testing.for_int_dtypes() @@ -174,7 +168,6 @@ def test_invalid_dtype(self, order, dtype): xp.unravel_index(a, (6, 4), order=order) -@testing.gpu class TestRavelMultiIndex(unittest.TestCase): @testing.for_orders(["C", "F", None]) @testing.for_int_dtypes() diff --git a/tests/third_party/cupy/indexing_tests/test_indexing.py b/tests/third_party/cupy/indexing_tests/test_indexing.py index 20890056ae05..7237e3991e20 100644 --- a/tests/third_party/cupy/indexing_tests/test_indexing.py +++ b/tests/third_party/cupy/indexing_tests/test_indexing.py @@ -193,7 +193,6 @@ def test_extract_empty_1dim(self, xp): @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestChoose(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() @@ -253,7 +252,6 @@ def test_choose_broadcast_fail(self, dtype): return a.choose(c) -@testing.gpu class TestSelect(unittest.TestCase): @testing.for_all_dtypes(no_bool=True, no_complex=True) @testing.numpy_cupy_array_equal() diff --git a/tests/third_party/cupy/indexing_tests/test_insert.py b/tests/third_party/cupy/indexing_tests/test_insert.py index 1840b22d5c46..28d25c487b0c 100644 --- a/tests/third_party/cupy/indexing_tests/test_insert.py +++ b/tests/third_party/cupy/indexing_tests/test_insert.py @@ -15,7 +15,6 @@ } ) ) -@testing.gpu class TestPlace(unittest.TestCase): # NumPy 1.9 don't wraps values. # https://github.com/numpy/numpy/pull/5821 @@ -39,7 +38,6 @@ def test_place(self, xp, dtype): } ) ) -@testing.gpu class TestPlaceRaises(unittest.TestCase): # NumPy 1.9 performs illegal memory access. # https://github.com/numpy/numpy/pull/5821 @@ -77,7 +75,6 @@ def test_place_shape_unmatch_error(self, dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestPut(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() @@ -105,7 +102,6 @@ def test_put(self, xp, dtype): } ) ) -@testing.gpu class TestPutScalars(unittest.TestCase): @pytest.mark.usefixtures("allow_fall_back_on_numpy") @testing.numpy_cupy_array_equal() @@ -136,7 +132,6 @@ def test_put_values_scalar(self, xp): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestPutRaises(unittest.TestCase): @testing.for_all_dtypes() def test_put_inds_underflow_error(self, dtype): @@ -170,7 +165,6 @@ def test_put_mode_error(self, dtype): @testing.parameterize( *testing.product({"shape": [(0,), (1,), (2, 3), (2, 3, 4)]}) ) -@testing.gpu class TestPutmaskSameShape(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() @@ -191,7 +185,6 @@ def test_putmask(self, xp, dtype): } ) ) -@testing.gpu class TestPutmaskDifferentShapes(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() @@ -207,7 +200,6 @@ def test_putmask(self, xp, dtype): @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestPutmask(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_putmask_scalar_values(self, xp): @@ -264,7 +256,6 @@ def test_putmask_differnt_dtypes_mask(self, xp, dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestFillDiagonal(unittest.TestCase): def _compute_val(self, xp): if type(self.val) is int: @@ -309,7 +300,6 @@ def test_1darray(self, dtype): } ) ) -@testing.gpu class TestDiagIndices(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_diag_indices(self, xp): @@ -324,7 +314,6 @@ def test_diag_indices(self, xp): } ) ) -@testing.gpu class TestDiagIndicesInvalidValues(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_diag_indices(self, xp): @@ -338,7 +327,6 @@ def test_diag_indices(self, xp): } ) ) -@testing.gpu class TestDiagIndicesFrom(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_diag_indices_from(self, xp): @@ -354,7 +342,6 @@ def test_diag_indices_from(self, xp): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDiagIndicesFromRaises(unittest.TestCase): def test_non_equal_dims(self): for xp in (numpy, cupy): diff --git a/tests/third_party/cupy/indexing_tests/test_iterate.py b/tests/third_party/cupy/indexing_tests/test_iterate.py index 603581b53aef..971f6a1f2a9c 100644 --- a/tests/third_party/cupy/indexing_tests/test_iterate.py +++ b/tests/third_party/cupy/indexing_tests/test_iterate.py @@ -8,7 +8,6 @@ from tests.third_party.cupy import testing -@testing.gpu class TestFlatiter(unittest.TestCase): def test_base(self): for xp in (numpy, cupy): @@ -61,7 +60,6 @@ def test_copy_next(self, xp): {"shape": (), "index": slice(None)}, {"shape": (10,), "index": slice(None)}, ) -@testing.gpu class TestFlatiterSubscript(unittest.TestCase): @testing.for_CF_orders() @testing.for_all_dtypes() @@ -122,7 +120,6 @@ def test_setitem_ndarray_different_types(self, xp, a_dtype, v_dtype, order): # {'shape': (2, 3, 4), 'index': cupy.array([0])}, {"shape": (2, 3, 4), "index": [0]}, ) -@testing.gpu class TestFlatiterSubscriptIndexError(unittest.TestCase): @testing.for_all_dtypes() def test_getitem(self, dtype): diff --git a/tests/third_party/cupy/logic_tests/test_comparison.py b/tests/third_party/cupy/logic_tests/test_comparison.py index 739ff9f7c959..b7dba2a219b8 100644 --- a/tests/third_party/cupy/logic_tests/test_comparison.py +++ b/tests/third_party/cupy/logic_tests/test_comparison.py @@ -8,7 +8,6 @@ from tests.third_party.cupy import testing -@testing.gpu class TestComparison(unittest.TestCase): @testing.for_all_dtypes(no_complex=True) @testing.numpy_cupy_allclose(atol=1e-5) @@ -36,7 +35,6 @@ def test_equal(self): self.check_binary("equal") -@testing.gpu class TestComparisonOperator(unittest.TestCase): operators = [ operator.lt, diff --git a/tests/third_party/cupy/logic_tests/test_content.py b/tests/third_party/cupy/logic_tests/test_content.py index ac67a4eef4c8..fe2446d68b2c 100644 --- a/tests/third_party/cupy/logic_tests/test_content.py +++ b/tests/third_party/cupy/logic_tests/test_content.py @@ -6,7 +6,6 @@ from tests.third_party.cupy import testing -@testing.gpu class TestContent(unittest.TestCase): @testing.for_dtypes("fd") @testing.numpy_cupy_array_equal() diff --git a/tests/third_party/cupy/logic_tests/test_truth.py b/tests/third_party/cupy/logic_tests/test_truth.py index aa0e563ec42a..e715aa24405a 100644 --- a/tests/third_party/cupy/logic_tests/test_truth.py +++ b/tests/third_party/cupy/logic_tests/test_truth.py @@ -74,14 +74,14 @@ def test_with_out(self, xp, dtype): ) ) class TestAllAnyWithNaN(unittest.TestCase): - @testing.for_dtypes((*testing.helper._float_dtypes, numpy.bool_)) + @testing.for_dtypes((*testing._loops._float_dtypes, numpy.bool_)) @testing.numpy_cupy_array_equal() def test_without_out(self, xp, dtype): x = xp.asarray(self.x).astype(dtype) return getattr(xp, self.f)(x, self.axis, None, self.keepdims) @pytest.mark.usefixtures("allow_fall_back_on_numpy") - @testing.for_dtypes((*testing.helper._float_dtypes, numpy.bool_)) + @testing.for_dtypes((*testing._loops._float_dtypes, numpy.bool_)) @testing.numpy_cupy_array_equal() def test_with_out(self, xp, dtype): x = xp.asarray(self.x).astype(dtype) diff --git a/tests/third_party/cupy/manipulation_tests/test_shape.py b/tests/third_party/cupy/manipulation_tests/test_shape.py index 9b672b975539..1a99df5c954b 100644 --- a/tests/third_party/cupy/manipulation_tests/test_shape.py +++ b/tests/third_party/cupy/manipulation_tests/test_shape.py @@ -14,7 +14,6 @@ } ) ) -@testing.gpu class TestShape(unittest.TestCase): def test_shape(self): shape = self.shape @@ -29,7 +28,6 @@ def test_shape_list(self): assert cupy.shape(a) == shape -@testing.gpu class TestReshape(unittest.TestCase): # order = 'A' is out of support currently _supported_orders = "CF" @@ -157,7 +155,6 @@ def test_ndim_limit2(self, dtype, order): self._test_ndim_limit(xp, 33, dtype, order) -@testing.gpu class TestRavel(unittest.TestCase): @testing.for_orders("CF") # order = 'A' is out of support currently @@ -204,7 +201,6 @@ def test_external_ravel(self, xp): } ) ) -@testing.gpu class TestReshapeOrder(unittest.TestCase): def test_reshape_contiguity(self): shape_init, shape_final = self.shape_in_out diff --git a/tests/third_party/cupy/manipulation_tests/test_tiling.py b/tests/third_party/cupy/manipulation_tests/test_tiling.py index 575be6fe0afb..6fc75cf82985 100644 --- a/tests/third_party/cupy/manipulation_tests/test_tiling.py +++ b/tests/third_party/cupy/manipulation_tests/test_tiling.py @@ -17,7 +17,6 @@ {"repeats": [1, 2, 3], "axis": -2}, ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestRepeat(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_array_repeat(self, xp): @@ -44,7 +43,6 @@ def test_method(self): {"repeats": [2], "axis": 1}, ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestRepeatListBroadcast(unittest.TestCase): """Test for `repeats` argument using single element list. @@ -66,7 +64,6 @@ def test_array_repeat(self, xp): {"repeats": [1, 2, 3, 4], "axis": 0}, ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestRepeat1D(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_array_repeat(self, xp): @@ -78,7 +75,6 @@ def test_array_repeat(self, xp): {"repeats": [2], "axis": None}, {"repeats": [2], "axis": 0}, ) -@testing.gpu class TestRepeat1DListBroadcast(unittest.TestCase): """See comment in TestRepeatListBroadcast class.""" @@ -98,7 +94,6 @@ def test_array_repeat(self, xp): {"repeats": 2, "axis": 3}, ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestRepeatFailure(unittest.TestCase): def test_repeat_failure(self): for xp in (numpy, cupy): @@ -115,7 +110,6 @@ def test_repeat_failure(self): {"reps": (2, 3)}, {"reps": (2, 3, 4, 5)}, ) -@testing.gpu class TestTile(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_array_tile(self, xp): @@ -127,7 +121,6 @@ def test_array_tile(self, xp): {"reps": -1}, {"reps": (-1, -2)}, ) -@testing.gpu class TestTileFailure(unittest.TestCase): def test_tile_failure(self): for xp in (numpy, cupy): diff --git a/tests/third_party/cupy/manipulation_tests/test_transpose.py b/tests/third_party/cupy/manipulation_tests/test_transpose.py index d758d15d3f77..331ff5c22854 100644 --- a/tests/third_party/cupy/manipulation_tests/test_transpose.py +++ b/tests/third_party/cupy/manipulation_tests/test_transpose.py @@ -7,7 +7,6 @@ from tests.third_party.cupy import testing -@testing.gpu class TestTranspose(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_moveaxis1(self, xp): diff --git a/tests/third_party/cupy/math_tests/test_arithmetic.py b/tests/third_party/cupy/math_tests/test_arithmetic.py index 9297b3de937f..e957c9d935bd 100644 --- a/tests/third_party/cupy/math_tests/test_arithmetic.py +++ b/tests/third_party/cupy/math_tests/test_arithmetic.py @@ -9,7 +9,7 @@ from tests.helper import has_support_aspect64 from tests.third_party.cupy import testing -float_types = list(testing.helper._float_dtypes) +float_types = list(testing._loops._float_dtypes) complex_types = [] signed_int_types = [numpy.int32, numpy.int64] unsigned_int_types = [] @@ -243,7 +243,7 @@ def check_binary(self, xp): return xp.array(True) func = getattr(xp, self.name) - with testing.NumpyError(divide="ignore"): + with numpy.errstate(divide="ignore"): with warnings.catch_warnings(): warnings.filterwarnings("ignore") if self.use_dtype: @@ -270,7 +270,6 @@ def check_binary(self, xp): return y -@testing.gpu @testing.parameterize( *( testing.product( @@ -312,7 +311,6 @@ def test_binary(self): self.check_binary() -@testing.gpu @testing.parameterize( *( testing.product( @@ -411,7 +409,6 @@ def test_modf(self, xp, dtype): @testing.parameterize( *testing.product({"xp": [numpy, cupy], "shape": [(3, 2), (), (3, 0, 2)]}) ) -@testing.gpu class TestBoolSubtract(unittest.TestCase): def test_bool_subtract(self): xp = self.xp diff --git a/tests/third_party/cupy/math_tests/test_explog.py b/tests/third_party/cupy/math_tests/test_explog.py index 85f3baa96bae..6ead99599cc2 100644 --- a/tests/third_party/cupy/math_tests/test_explog.py +++ b/tests/third_party/cupy/math_tests/test_explog.py @@ -38,15 +38,15 @@ def test_exp2(self): self.check_unary("exp2") def test_log(self): - with testing.NumpyError(divide="ignore"): + with numpy.errstate(divide="ignore"): self.check_unary("log") def test_log10(self): - with testing.NumpyError(divide="ignore"): + with numpy.errstate(divide="ignore"): self.check_unary("log10") def test_log2(self): - with testing.NumpyError(divide="ignore"): + with numpy.errstate(divide="ignore"): self.check_unary("log2") def test_log1p(self): diff --git a/tests/third_party/cupy/math_tests/test_floating.py b/tests/third_party/cupy/math_tests/test_floating.py index eeb9000a75a5..09531104a543 100644 --- a/tests/third_party/cupy/math_tests/test_floating.py +++ b/tests/third_party/cupy/math_tests/test_floating.py @@ -7,7 +7,6 @@ from tests.third_party.cupy import testing -@testing.gpu class TestFloating(unittest.TestCase): @testing.for_all_dtypes(no_complex=True) @testing.numpy_cupy_array_equal() diff --git a/tests/third_party/cupy/random_tests/test_distributions.py b/tests/third_party/cupy/random_tests/test_distributions.py index 56e084aa8256..5fd0a6c4b7b9 100644 --- a/tests/third_party/cupy/random_tests/test_distributions.py +++ b/tests/third_party/cupy/random_tests/test_distributions.py @@ -6,7 +6,7 @@ import dpnp as cupy from dpnp import random as _distributions from tests.third_party.cupy import testing -from tests.third_party.cupy.testing import helper +from tests.third_party.cupy.testing import _helper, _loops _regular_float_dtypes = (numpy.float64, numpy.float32) _float_dtypes = _regular_float_dtypes + (numpy.float16,) @@ -39,9 +39,8 @@ def check_distribution(self, dist_name, params): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsBeta(RandomDistributionsTestCase): - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["a_dtype", "b_dtype"] ) def test_beta(self, a_dtype, b_dtype): @@ -60,13 +59,12 @@ def test_beta(self, a_dtype, b_dtype): } ) ) -@testing.gpu class TestDistributionsBinomial(RandomDistributionsTestCase): - @helper.for_signed_dtypes("n_dtype") - @helper.for_float_dtypes("p_dtype") + @_loops.for_signed_dtypes("n_dtype") + @_loops.for_float_dtypes("p_dtype") def test_binomial(self, n_dtype, p_dtype): if numpy.dtype("l") == numpy.int32 and n_dtype == numpy.int64: - self.skipTest("n must be able to cast to long") + pytest.skip("n must be able to cast to long") n = numpy.full(self.n_shape, 5, dtype=n_dtype) p = numpy.full(self.p_shape, 0.5, dtype=p_dtype) self.check_distribution("binomial", {"n": n, "p": p}, self.dtype) @@ -81,7 +79,6 @@ def test_binomial(self, n_dtype, p_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsChisquare(unittest.TestCase): def check_distribution(self, dist_func, df_dtype): df = cupy.full(self.df_shape, 5, dtype=df_dtype) @@ -90,7 +87,7 @@ def check_distribution(self, dist_func, df_dtype): # numpy and dpdp output dtype is float64 self.assertEqual(out.dtype, numpy.float64) - @helper.for_float_dtypes("df_dtype") + @_loops.for_float_dtypes("df_dtype") def test_chisquare(self, df_dtype): self.check_distribution(_distributions.chisquare, df_dtype) @@ -104,9 +101,8 @@ def test_chisquare(self, df_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsDirichlet(RandomDistributionsTestCase): - @helper.for_dtypes_combination(_regular_float_dtypes, names=["alpha_dtype"]) + @_loops.for_dtypes_combination(_regular_float_dtypes, names=["alpha_dtype"]) def test_dirichlet(self, alpha_dtype): alpha = numpy.ones(self.alpha_shape, dtype=alpha_dtype) self.check_distribution("dirichlet", {"alpha": alpha}) @@ -121,16 +117,14 @@ def test_dirichlet(self, alpha_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsExponential(RandomDistributionsTestCase): - @helper.for_float_dtypes("scale_dtype") + @_loops.for_float_dtypes("scale_dtype") def test_exponential(self, scale_dtype): scale = numpy.ones(self.scale_shape, dtype=scale_dtype) self.check_distribution("exponential", {"scale": scale}) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsExponentialError(RandomDistributionsTestCase): def test_negative_scale(self): scale = cupy.array([2, -1, 3], dtype=numpy.float32) @@ -148,7 +142,6 @@ def test_negative_scale(self): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsF(unittest.TestCase): def check_distribution(self, dist_func, dfnum_dtype, dfden_dtype): dfnum = cupy.ones(self.dfnum_shape, dtype=dfnum_dtype) @@ -158,8 +151,8 @@ def check_distribution(self, dist_func, dfnum_dtype, dfden_dtype): # numpy and dpdp output dtype is float64 self.assertEqual(out.dtype, numpy.float64) - @helper.for_float_dtypes("dfnum_dtype") - @helper.for_float_dtypes("dfden_dtype") + @_loops.for_float_dtypes("dfnum_dtype") + @_loops.for_float_dtypes("dfden_dtype") def test_f(self, dfnum_dtype, dfden_dtype): self.check_distribution(_distributions.f, dfnum_dtype, dfden_dtype) @@ -174,7 +167,6 @@ def test_f(self, dfnum_dtype, dfden_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsGamma(unittest.TestCase): def check_distribution(self, dist_func, shape_dtype, scale_dtype): shape = cupy.ones(self.shape_shape, dtype=shape_dtype) @@ -184,7 +176,7 @@ def check_distribution(self, dist_func, shape_dtype, scale_dtype): # numpy and dpdp output dtype is float64 self.assertEqual(out.dtype, numpy.float64) - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["shape_dtype", "scale_dtype"] ) def test_gamma(self, shape_dtype, scale_dtype): @@ -199,7 +191,6 @@ def test_gamma(self, shape_dtype, scale_dtype): } ) ) -@testing.gpu class TestDistributionsGeometric(unittest.TestCase): def check_distribution(self, dist_func, p_dtype): p = 0.5 * cupy.ones(self.p_shape, dtype=p_dtype) @@ -208,7 +199,7 @@ def check_distribution(self, dist_func, p_dtype): # numpy output dtype is int64, dpnp output is int32 self.assertEqual(out.dtype, numpy.int64) - @helper.for_float_dtypes("p_dtype") + @_loops.for_float_dtypes("p_dtype") def test_geometric(self, p_dtype): self.check_distribution(_distributions.geometric, p_dtype) @@ -223,9 +214,8 @@ def test_geometric(self, p_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsGumbel(RandomDistributionsTestCase): - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["loc_dtype", "scale_dtype"] ) def test_gumbel(self, loc_dtype, scale_dtype): @@ -245,7 +235,6 @@ def test_gumbel(self, loc_dtype, scale_dtype): } ) ) -@testing.gpu class TestDistributionsHyperGeometric(unittest.TestCase): def check_distribution( self, dist_func, ngood_dtype, nbad_dtype, nsample_dtype @@ -258,7 +247,7 @@ def check_distribution( # numpy output dtype is int64, dpnp output is int32 self.assertEqual(out.dtype, numpy.int64) - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( [numpy.int32, numpy.int64], names=["ngood_dtype", "nbad_dtype"] ) def test_hypergeometric(self, ngood_dtype, nbad_dtype): @@ -280,9 +269,8 @@ def test_hypergeometric(self, ngood_dtype, nbad_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsuLaplace(RandomDistributionsTestCase): - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["loc_dtype", "scale_dtype"] ) def test_laplace(self, loc_dtype, scale_dtype): @@ -301,9 +289,8 @@ def test_laplace(self, loc_dtype, scale_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsLogistic(RandomDistributionsTestCase): - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["loc_dtype", "scale_dtype"] ) def test_logistic(self, loc_dtype, scale_dtype): @@ -321,9 +308,8 @@ def test_logistic(self, loc_dtype, scale_dtype): } ) ) -@testing.gpu class TestDistributionsLognormal(RandomDistributionsTestCase): - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["mean_dtype", "sigma_dtype"] ) def test_lognormal(self, mean_dtype, sigma_dtype): @@ -340,14 +326,13 @@ def test_lognormal(self, mean_dtype, sigma_dtype): } ) ) -@testing.gpu class TestDistributionsLogseries(RandomDistributionsTestCase): - @helper.for_float_dtypes("p_dtype", no_float16=True) + @_loops.for_float_dtypes("p_dtype", no_float16=True) def test_logseries(self, p_dtype): p = numpy.full(self.p_shape, 0.5, dtype=p_dtype) self.check_distribution("logseries", {"p": p}) - @helper.for_float_dtypes("p_dtype", no_float16=True) + @_loops.for_float_dtypes("p_dtype", no_float16=True) def test_logseries_for_invalid_p(self, p_dtype): with self.assertRaises(ValueError): cp_params = {"p": cupy.zeros(self.p_shape, dtype=p_dtype)} @@ -365,7 +350,6 @@ def test_logseries_for_invalid_p(self, p_dtype): } ) ) -@testing.gpu class TestDistributionsMultivariateNormal(unittest.TestCase): def check_distribution(self, dist_func, mean_dtype, cov_dtype): mean = cupy.zeros(self.d, dtype=mean_dtype) @@ -381,8 +365,8 @@ def check_distribution(self, dist_func, mean_dtype, cov_dtype): # numpy and dpdp output dtype is float64 self.assertEqual(out.dtype, numpy.float64) - @helper.for_float_dtypes("mean_dtype", no_float16=True) - @helper.for_float_dtypes("cov_dtype", no_float16=True) + @_loops.for_float_dtypes("mean_dtype", no_float16=True) + @_loops.for_float_dtypes("cov_dtype", no_float16=True) def test_normal(self, mean_dtype, cov_dtype): self.check_distribution( _distributions.multivariate_normal, mean_dtype, cov_dtype @@ -399,17 +383,16 @@ def test_normal(self, mean_dtype, cov_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsNegativeBinomial(RandomDistributionsTestCase): - @helper.for_float_dtypes("n_dtype") - @helper.for_float_dtypes("p_dtype") + @_loops.for_float_dtypes("n_dtype") + @_loops.for_float_dtypes("p_dtype") def test_negative_binomial(self, n_dtype, p_dtype): n = numpy.full(self.n_shape, 5, dtype=n_dtype) p = numpy.full(self.p_shape, 0.5, dtype=p_dtype) self.check_distribution("negative_binomial", {"n": n, "p": p}) - @helper.for_float_dtypes("n_dtype") - @helper.for_float_dtypes("p_dtype") + @_loops.for_float_dtypes("n_dtype") + @_loops.for_float_dtypes("p_dtype") def test_negative_binomial_for_noninteger_n(self, n_dtype, p_dtype): n = numpy.full(self.n_shape, 5.5, dtype=n_dtype) p = numpy.full(self.p_shape, 0.5, dtype=p_dtype) @@ -426,9 +409,8 @@ def test_negative_binomial_for_noninteger_n(self, n_dtype, p_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsNoncentralChisquare(RandomDistributionsTestCase): - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["df_dtype", "nonc_dtype"] ) def test_noncentral_chisquare(self, df_dtype, nonc_dtype): @@ -438,7 +420,7 @@ def test_noncentral_chisquare(self, df_dtype, nonc_dtype): "noncentral_chisquare", {"df": df, "nonc": nonc} ) - @helper.for_float_dtypes("param_dtype", no_float16=True) + @_loops.for_float_dtypes("param_dtype", no_float16=True) def test_noncentral_chisquare_for_invalid_params(self, param_dtype): df = cupy.full(self.df_shape, -1, dtype=param_dtype) nonc = cupy.full(self.nonc_shape, 1, dtype=param_dtype) @@ -462,9 +444,8 @@ def test_noncentral_chisquare_for_invalid_params(self, param_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsNoncentralF(RandomDistributionsTestCase): - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["dfnum_dtype", "dfden_dtype", "nonc_dtype"], ) @@ -476,7 +457,7 @@ def test_noncentral_f(self, dfnum_dtype, dfden_dtype, nonc_dtype): "noncentral_f", {"dfnum": dfnum, "dfden": dfden, "nonc": nonc} ) - @helper.for_float_dtypes("param_dtype", no_float16=True) + @_loops.for_float_dtypes("param_dtype", no_float16=True) def test_noncentral_f_for_invalid_params(self, param_dtype): dfnum = numpy.full(self.dfnum_shape, -1, dtype=param_dtype) dfden = numpy.full(self.dfden_shape, 1, dtype=param_dtype) @@ -507,9 +488,8 @@ def test_noncentral_f_for_invalid_params(self, param_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsNormal(RandomDistributionsTestCase): - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["loc_dtype", "scale_dtype"] ) def test_normal(self, loc_dtype, scale_dtype): @@ -527,7 +507,6 @@ def test_normal(self, loc_dtype, scale_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsPareto(unittest.TestCase): def check_distribution(self, dist_func, a_dtype): a = cupy.ones(self.a_shape, dtype=a_dtype) @@ -536,7 +515,7 @@ def check_distribution(self, dist_func, a_dtype): # numpy and dpdp output dtype is float64 self.assertEqual(out.dtype, numpy.float64) - @helper.for_float_dtypes("a_dtype") + @_loops.for_float_dtypes("a_dtype") def test_pareto(self, a_dtype): self.check_distribution(_distributions.pareto, a_dtype) @@ -549,7 +528,6 @@ def test_pareto(self, a_dtype): } ) ) -@testing.gpu class TestDistributionsPoisson(unittest.TestCase): def check_distribution(self, dist_func, lam_dtype): lam = cupy.full(self.lam_shape, 5, dtype=lam_dtype) @@ -558,7 +536,7 @@ def check_distribution(self, dist_func, lam_dtype): # numpy output dtype is int64, dpnp output is int32 self.assertEqual(out.dtype, numpy.int64) - @helper.for_float_dtypes("lam_dtype") + @_loops.for_float_dtypes("lam_dtype") def test_poisson(self, lam_dtype): self.check_distribution(_distributions.poisson, lam_dtype) @@ -571,14 +549,13 @@ def test_poisson(self, lam_dtype): } ) ) -@testing.gpu class TestDistributionsPower(RandomDistributionsTestCase): - @helper.for_float_dtypes("a_dtype") + @_loops.for_float_dtypes("a_dtype") def test_power(self, a_dtype): a = numpy.full(self.a_shape, 0.5, dtype=a_dtype) self.check_distribution("power", {"a": a}) - @helper.for_float_dtypes("a_dtype") + @_loops.for_float_dtypes("a_dtype") def test_power_for_negative_a(self, a_dtype): a = numpy.full(self.a_shape, -0.5, dtype=a_dtype) with self.assertRaises(ValueError): @@ -595,19 +572,18 @@ def test_power_for_negative_a(self, a_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsRayleigh(RandomDistributionsTestCase): - @helper.for_float_dtypes("scale_dtype") + @_loops.for_float_dtypes("scale_dtype") def test_rayleigh(self, scale_dtype): scale = numpy.full(self.scale_shape, 3, dtype=scale_dtype) self.check_distribution("rayleigh", {"scale": scale}) - @helper.for_float_dtypes("scale_dtype") + @_loops.for_float_dtypes("scale_dtype") def test_rayleigh_for_zero_scale(self, scale_dtype): scale = numpy.zeros(self.scale_shape, dtype=scale_dtype) self.check_distribution("rayleigh", {"scale": scale}) - @helper.for_float_dtypes("scale_dtype") + @_loops.for_float_dtypes("scale_dtype") def test_rayleigh_for_negative_scale(self, scale_dtype): scale = numpy.full(self.scale_shape, -0.5, dtype=scale_dtype) with self.assertRaises(ValueError): @@ -622,7 +598,6 @@ def test_rayleigh_for_negative_scale(self, scale_dtype): } ) ) -@testing.gpu class TestDistributionsStandardCauchy(RandomDistributionsTestCase): def test_standard_cauchy(self): self.check_distribution("standard_cauchy", {}) @@ -635,7 +610,6 @@ def test_standard_cauchy(self): } ) ) -@testing.gpu class TestDistributionsStandardExponential(RandomDistributionsTestCase): def test_standard_exponential(self): self.check_distribution("standard_exponential", {}) @@ -650,9 +624,8 @@ def test_standard_exponential(self): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsStandardGamma(RandomDistributionsTestCase): - @helper.for_float_dtypes("shape_dtype") + @_loops.for_float_dtypes("shape_dtype") def test_standard_gamma(self, shape_dtype): shape = numpy.ones(self.shape_shape, dtype=shape_dtype) self.check_distribution("standard_gamma", {"shape": shape}) @@ -665,7 +638,6 @@ def test_standard_gamma(self, shape_dtype): } ) ) -@testing.gpu class TestDistributionsStandardNormal(RandomDistributionsTestCase): def test_standard_normal(self): self.check_distribution("standard_normal", {}) @@ -680,7 +652,6 @@ def test_standard_normal(self): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsStandardT(unittest.TestCase): def check_distribution(self, dist_func, df_dtype): df = cupy.ones(self.df_shape, dtype=df_dtype) @@ -689,7 +660,7 @@ def check_distribution(self, dist_func, df_dtype): # numpy and dpdp output dtype is float64 self.assertEqual(out.dtype, numpy.float64) - @helper.for_float_dtypes("df_dtype") + @_loops.for_float_dtypes("df_dtype") def test_standard_t(self, df_dtype): self.check_distribution(_distributions.standard_t, df_dtype) @@ -705,9 +676,8 @@ def test_standard_t(self, df_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsTriangular(RandomDistributionsTestCase): - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["left_dtype", "mode_dtype", "right_dtype"] ) def test_triangular(self, left_dtype, mode_dtype, right_dtype): @@ -718,7 +688,7 @@ def test_triangular(self, left_dtype, mode_dtype, right_dtype): "triangular", {"left": left, "mode": mode, "right": right} ) - @helper.for_float_dtypes("param_dtype", no_float16=True) + @_loops.for_float_dtypes("param_dtype", no_float16=True) def test_triangular_for_invalid_params(self, param_dtype): left = cupy.full(self.left_shape, 1, dtype=param_dtype) mode = cupy.full(self.mode_shape, 0, dtype=param_dtype) @@ -749,9 +719,8 @@ def test_triangular_for_invalid_params(self, param_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsUniform(RandomDistributionsTestCase): - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["low_dtype", "high_dtype"] ) def test_uniform(self, low_dtype, high_dtype): @@ -770,7 +739,6 @@ def test_uniform(self, low_dtype, high_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsVonmises(unittest.TestCase): def check_distribution(self, dist_func, mu_dtype, kappa_dtype): mu = cupy.ones(self.mu_shape, dtype=mu_dtype) @@ -780,7 +748,7 @@ def check_distribution(self, dist_func, mu_dtype, kappa_dtype): # numpy and dpdp output dtype is float64 self.assertEqual(out.dtype, numpy.float64) - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["mu_dtype", "kappa_dtype"] ) def test_vonmises(self, mu_dtype, kappa_dtype): @@ -797,9 +765,8 @@ def test_vonmises(self, mu_dtype, kappa_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsWald(RandomDistributionsTestCase): - @helper.for_dtypes_combination( + @_loops.for_dtypes_combination( _regular_float_dtypes, names=["mean_dtype", "scale_dtype"] ) def test_wald(self, mean_dtype, scale_dtype): @@ -817,19 +784,18 @@ def test_wald(self, mean_dtype, scale_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsWeibull(RandomDistributionsTestCase): - @helper.for_float_dtypes("a_dtype") + @_loops.for_float_dtypes("a_dtype") def test_weibull(self, a_dtype): a = numpy.ones(self.a_shape, dtype=a_dtype) self.check_distribution("weibull", {"a": a}) - @helper.for_float_dtypes("a_dtype") + @_loops.for_float_dtypes("a_dtype") def test_weibull_for_inf_a(self, a_dtype): a = numpy.full(self.a_shape, numpy.inf, dtype=a_dtype) self.check_distribution("weibull", {"a": a}) - @helper.for_float_dtypes("a_dtype") + @_loops.for_float_dtypes("a_dtype") def test_weibull_for_negative_a(self, a_dtype): a = numpy.full(self.a_shape, -0.5, dtype=a_dtype) with self.assertRaises(ValueError): @@ -846,10 +812,9 @@ def test_weibull_for_negative_a(self, a_dtype): ) ) @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestDistributionsZipf(RandomDistributionsTestCase): - @helper.for_dtypes([numpy.int32, numpy.int64], "dtype") - @helper.for_float_dtypes("a_dtype") + @_loops.for_dtypes([numpy.int32, numpy.int64], "dtype") + @_loops.for_float_dtypes("a_dtype") def test_zipf(self, a_dtype, dtype): a = numpy.full(self.a_shape, 2, dtype=a_dtype) self.check_distribution("zipf", {"a": a}) diff --git a/tests/third_party/cupy/random_tests/test_sample.py b/tests/third_party/cupy/random_tests/test_sample.py index 79e2370ad05e..d26d39eb1ba9 100644 --- a/tests/third_party/cupy/random_tests/test_sample.py +++ b/tests/third_party/cupy/random_tests/test_sample.py @@ -7,10 +7,9 @@ import dpnp as cupy from dpnp import random from tests.third_party.cupy import testing -from tests.third_party.cupy.testing import _condition, hypothesis +from tests.third_party.cupy.testing import _condition, _hypothesis -@testing.gpu class TestRandint(unittest.TestCase): def test_lo_hi_reversed(self): with self.assertRaises(ValueError): @@ -40,7 +39,8 @@ def test_zero_sizes(self): # @testing.fix_random() -@testing.gpu + + class TestRandint2(unittest.TestCase): @pytest.mark.usefixtures("allow_fall_back_on_numpy") @_condition.repeat(3, 10) @@ -97,7 +97,7 @@ def test_goodness_of_fit(self): vals = [numpy.random.randint(mx) for _ in range(trial)] counts = numpy.histogram(vals, bins=numpy.arange(mx + 1))[0] expected = numpy.array([float(trial) / mx] * mx) - self.assertTrue(hypothesis.chi_square_test(counts, expected)) + self.assertTrue(_hypothesis.chi_square_test(counts, expected)) @_condition.repeat(3, 10) def test_goodness_of_fit_2(self): @@ -105,10 +105,9 @@ def test_goodness_of_fit_2(self): vals = random.randint(mx, size=(5, 20)) counts = numpy.histogram(vals, bins=numpy.arange(mx + 1))[0] expected = numpy.array([float(vals.size) / mx] * mx) - self.assertTrue(hypothesis.chi_square_test(counts, expected)) + self.assertTrue(_hypothesis.chi_square_test(counts, expected)) -@testing.gpu class TestRandintDtype(unittest.TestCase): # numpy.int8, numpy.uint8, numpy.int16, numpy.uint16, numpy.int32]) @testing.for_dtypes([numpy.int32]) @@ -142,7 +141,6 @@ def test_dtype2(self, dtype): random.randint(iinfo.max - 10, iinfo.max + 2, size, dtype) -@testing.gpu class TestRandomIntegers(unittest.TestCase): def test_normal(self): with mock.patch("dpnp.random.RandomState.randint") as m: @@ -167,7 +165,6 @@ def test_size_is_not_none(self): @testing.fix_random() -@testing.gpu class TestRandomIntegers2(unittest.TestCase): @_condition.repeat(3, 10) def test_bound_1(self): @@ -192,7 +189,7 @@ def test_goodness_of_fit(self): vals = [random.randint(0, mx).get() for _ in range(trial)] counts = numpy.histogram(vals, bins=numpy.arange(mx + 1))[0] expected = numpy.array([float(trial) / mx] * mx) - self.assertTrue(hypothesis.chi_square_test(counts, expected)) + self.assertTrue(_hypothesis.chi_square_test(counts, expected)) @_condition.repeat(3, 10) def test_goodness_of_fit_2(self): @@ -200,10 +197,9 @@ def test_goodness_of_fit_2(self): vals = random.randint(0, mx, (5, 20)).get() counts = numpy.histogram(vals, bins=numpy.arange(mx + 1))[0] expected = numpy.array([float(vals.size) / mx] * mx) - self.assertTrue(hypothesis.chi_square_test(counts, expected)) + self.assertTrue(_hypothesis.chi_square_test(counts, expected)) -@testing.gpu class TestChoice(unittest.TestCase): def setUp(self): self.rs_tmp = random.generator._random_states @@ -248,7 +244,6 @@ def test_no_none(self): self.m.choice.assert_called_with(3, 1, True, [0.1, 0.1, 0.8]) -# @testing.gpu class TestRandomSample(unittest.TestCase): def test_rand(self): # no keyword argument 'dtype' in dpnp @@ -287,7 +282,6 @@ def test_randn_invalid_argument(self): {"size": (1, 0)}, ) @testing.fix_random() -@testing.gpu class TestMultinomial(unittest.TestCase): @_condition.repeat(3, 10) @testing.for_float_dtypes() diff --git a/tests/third_party/cupy/sorting_tests/test_search.py b/tests/third_party/cupy/sorting_tests/test_search.py index 11343da25a5a..5e0af865a5e8 100644 --- a/tests/third_party/cupy/sorting_tests/test_search.py +++ b/tests/third_party/cupy/sorting_tests/test_search.py @@ -165,7 +165,7 @@ def test_argmin_zero_size_axis1(self, xp, dtype): # 'shape': [(10,), (10, 20), (10, 20, 30), (10, 20, 30, 40)], # 'order': ('C', 'F'), # })) -# @testing.gpu + # @unittest.skipUnless(cupy.cuda.cub.available, 'The CUB routine is not enabled') # class TestCubReduction(unittest.TestCase): @@ -250,7 +250,6 @@ def test_argminmax_dtype(self, in_dtype, result_dtype): {"cond_shape": (2, 3, 4), "x_shape": (2, 3, 4), "y_shape": (3, 4)}, {"cond_shape": (3, 4), "x_shape": (2, 3, 4), "y_shape": (4,)}, ) -@testing.gpu class TestWhereTwoArrays(unittest.TestCase): @testing.for_all_dtypes_combination(names=["cond_type", "x_type", "y_type"]) @testing.numpy_cupy_allclose(type_check=False) @@ -270,7 +269,6 @@ def test_where_two_arrays(self, xp, cond_type, x_type, y_type): {"cond_shape": (2, 3, 4)}, {"cond_shape": (3, 4)}, ) -@testing.gpu class TestWhereCond(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() @@ -280,7 +278,6 @@ def test_where_cond(self, xp, dtype): return xp.where(cond) -@testing.gpu class TestWhereError(unittest.TestCase): def test_one_argument(self): for xp in (numpy, cupy): @@ -294,9 +291,9 @@ def test_one_argument(self): {"array": numpy.empty((0,))}, {"array": numpy.empty((0, 2))}, {"array": numpy.empty((0, 2, 0))}, + _ids=False, # Do not generate ids from randomly generated params ) -@testing.gpu -class TestNonzero(unittest.TestCase): +class TestNonzero: @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() def test_nonzero(self, xp, dtype): @@ -308,7 +305,6 @@ def test_nonzero(self, xp, dtype): {"array": numpy.array(0)}, {"array": numpy.array(1)}, ) -@testing.gpu @testing.with_requires("numpy>=1.17.0") class TestNonzeroZeroDimension(unittest.TestCase): @testing.for_all_dtypes() @@ -325,9 +321,9 @@ def test_nonzero(self, dtype): {"array": numpy.empty((0,))}, {"array": numpy.empty((0, 2))}, {"array": numpy.empty((0, 2, 0))}, + _ids=False, # Do not generate ids from randomly generated params ) -@testing.gpu -class TestFlatNonzero(unittest.TestCase): +class TestFlatNonzero: @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() def test_flatnonzero(self, xp, dtype): @@ -339,9 +335,9 @@ def test_flatnonzero(self, xp, dtype): {"array": numpy.empty((0,))}, {"array": numpy.empty((0, 2))}, {"array": numpy.empty((0, 2, 0))}, + _ids=False, # Do not generate ids from randomly generated params ) -@testing.gpu -class TestArgwhere(unittest.TestCase): +class TestArgwhere: @testing.for_all_dtypes() @testing.numpy_cupy_array_equal() def test_argwhere(self, xp, dtype): @@ -356,7 +352,7 @@ def test_argwhere(self, xp, dtype): # @testing.parameterize( # {'array': cupy.array(1)}, # ) -# @testing.gpu + # class TestArgwhereZeroDimension(unittest.TestCase): # def test_argwhere(self): @@ -544,7 +540,6 @@ def test_nanargmax_zero_size_axis1(self, xp, dtype): return xp.nanargmax(a, axis=1) -@testing.gpu @testing.parameterize( *testing.product( { @@ -577,7 +572,6 @@ def test_searchsorted(self, xp, dtype): return (y,) -@testing.gpu @testing.parameterize({"side": "left"}, {"side": "right"}) @pytest.mark.usefixtures("allow_fall_back_on_numpy") class TestSearchSortedNanInf(unittest.TestCase): @@ -642,7 +636,6 @@ def test_searchsorted_minf(self, xp): @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestSearchSortedInvalid(unittest.TestCase): # Cant test unordered bins due to numpy undefined # behavior for searchsorted @@ -656,7 +649,6 @@ def test_searchsorted_ndbins(self): @pytest.mark.usefixtures("allow_fall_back_on_numpy") -@testing.gpu class TestSearchSortedWithSorter(unittest.TestCase): @testing.numpy_cupy_array_equal() def test_sorter(self, xp): diff --git a/tests/third_party/cupy/sorting_tests/test_sort.py b/tests/third_party/cupy/sorting_tests/test_sort.py index 60a48b31e381..8715702db51b 100644 --- a/tests/third_party/cupy/sorting_tests/test_sort.py +++ b/tests/third_party/cupy/sorting_tests/test_sort.py @@ -210,7 +210,6 @@ def test_large(self, xp): return xp.sort(a, axis=-1) -@testing.gpu class TestLexsort(unittest.TestCase): # Test ranks @@ -412,7 +411,6 @@ def test_nan2(self, xp, dtype): return self.argsort(a) -@testing.gpu class TestMsort(unittest.TestCase): # Test base cases @@ -437,7 +435,6 @@ def test_msort_multi_dim(self, xp, dtype): return xp.msort(a) -@testing.gpu class TestSort_complex(unittest.TestCase): def test_sort_complex_zero_dim(self): for xp in (numpy, cupy): @@ -621,7 +618,6 @@ def test_partition_invalid_negative_axis2(self): } ) ) -@testing.gpu class TestArgpartition(unittest.TestCase): def argpartition(self, a, kth, axis=-1): if self.external: diff --git a/tests/third_party/cupy/statistics_tests/test_correlation.py b/tests/third_party/cupy/statistics_tests/test_correlation.py index 406bf8b8a970..be6b815629ff 100644 --- a/tests/third_party/cupy/statistics_tests/test_correlation.py +++ b/tests/third_party/cupy/statistics_tests/test_correlation.py @@ -10,7 +10,6 @@ from tests.third_party.cupy import testing -@testing.gpu class TestCorrcoef(unittest.TestCase): @testing.for_all_dtypes() @testing.numpy_cupy_allclose() @@ -143,7 +142,6 @@ def test_cov_empty(self): self.check((0, 1)) -@testing.gpu @testing.parameterize( *testing.product( { @@ -163,7 +161,6 @@ def test_correlate(self, xp, dtype): return xp.correlate(a, b, mode=self.mode) -@testing.gpu @testing.parameterize(*testing.product({"mode": ["valid", "full", "same"]})) @pytest.mark.usefixtures("allow_fall_back_on_numpy") class TestCorrelate(unittest.TestCase): @@ -189,7 +186,6 @@ def test_correlate_diff_types(self, xp, dtype1, dtype2): return xp.correlate(a, b, mode=self.mode) -@testing.gpu @testing.parameterize(*testing.product({"mode": ["valid", "same", "full"]})) @pytest.mark.usefixtures("allow_fall_back_on_numpy") class TestCorrelateInvalid(unittest.TestCase): diff --git a/tests/third_party/cupy/statistics_tests/test_histogram.py b/tests/third_party/cupy/statistics_tests/test_histogram.py index d605aada51c7..1fc8dcb5387c 100644 --- a/tests/third_party/cupy/statistics_tests/test_histogram.py +++ b/tests/third_party/cupy/statistics_tests/test_histogram.py @@ -40,10 +40,9 @@ def for_signed_dtypes_bincount(name="dtype"): def for_all_dtypes_combination_bincount(names): - return testing.helper.for_dtypes_combination(_all_types, names=names) + return testing._loops.for_dtypes_combination(_all_types, names=names) -@testing.gpu class TestHistogram(unittest.TestCase): @testing.for_all_dtypes(no_bool=True, no_complex=True) @testing.numpy_cupy_array_equal() @@ -335,7 +334,7 @@ def test_bincount_too_small_minlength(self, dtype): # This class compares CUB results against NumPy's -# @testing.gpu + # @unittest.skipUnless(cupy.cuda.cub.available, 'The CUB routine is not enabled') # class TestCubHistogram(unittest.TestCase): @@ -370,7 +369,6 @@ def test_bincount_too_small_minlength(self, dtype): # return h, b -@testing.gpu @testing.parameterize( *testing.product( { @@ -401,7 +399,6 @@ def test_digitize(self, xp, dtype): return (y,) -@testing.gpu @testing.parameterize({"right": True}, {"right": False}) class TestDigitizeNanInf(unittest.TestCase): @testing.numpy_cupy_array_equal() @@ -472,7 +469,6 @@ def test_searchsorted_minf(self, xp): return (y,) -@testing.gpu class TestDigitizeInvalid(unittest.TestCase): def test_digitize_complex(self): for xp in (numpy, cupy): diff --git a/tests/third_party/cupy/testing/__init__.py b/tests/third_party/cupy/testing/__init__.py index aa6c113706bd..99ddf9e50e2d 100644 --- a/tests/third_party/cupy/testing/__init__.py +++ b/tests/third_party/cupy/testing/__init__.py @@ -1,63 +1,58 @@ -# from tests.third_party.cupy.testing import array -# from tests.third_party.cupy.testing import attr -# from tests.third_party.cupy.testing import helper -from tests.third_party.cupy.testing import parameterized, random - -# from tests.third_party.cupy.testing.array import assert_array_almost_equal_nulp -# -from tests.third_party.cupy.testing.array import ( +from tests.third_party.cupy.testing._array import ( assert_allclose, assert_array_almost_equal, + assert_array_almost_equal_nulp, assert_array_equal, + assert_array_less, + assert_array_list_equal, + assert_array_max_ulp, ) +from tests.third_party.cupy.testing._attr import multi_gpu, slow -# from tests.third_party.cupy.testing.attr import multi_gpu -# from tests.third_party.cupy.testing.array import assert_array_less -# from tests.third_party.cupy.testing.array import assert_array_list_equal -# from tests.third_party.cupy.testing.array import assert_array_max_ulp -from tests.third_party.cupy.testing.attr import gpu, slow - -# from tests.third_party.cupy.testing.helper import numpy_cupy_raises -# from tests.third_party.cupy.testing.helper import numpy_cupy_array_max_ulp -# from tests.third_party.cupy.testing.helper import numpy_cupy_array_less -# from tests.third_party.cupy.testing.helper import numpy_cupy_array_almost_equal_nulp -# from tests.third_party.cupy.testing.helper import for_unsigned_dtypes_combination -# from tests.third_party.cupy.testing.helper import for_signed_dtypes_combination -# from tests.third_party.cupy.testing.helper import for_int_dtypes_combination -# from tests.third_party.cupy.testing.helper import empty -from tests.third_party.cupy.testing.helper import ( +# from tests.third_party.cupy.testing._helper import shaped_sparse_random +from tests.third_party.cupy.testing._helper import ( + AssertFunctionIsCalled, NumpyAliasBasicTestBase, NumpyAliasValuesTestBase, - NumpyError, assert_warns, + generate_matrix, + installed, + numpy_satisfies, + shaped_arange, + shaped_random, + shaped_reverse_arange, + with_requires, +) +from tests.third_party.cupy.testing._loops import ( for_all_dtypes, for_all_dtypes_combination, for_castings, for_CF_orders, for_complex_dtypes, + for_contiguous_axes, for_dtypes, for_dtypes_combination, for_float_dtypes, for_int_dtypes, + for_int_dtypes_combination, for_orders, for_signed_dtypes, + for_signed_dtypes_combination, for_unsigned_dtypes, + for_unsigned_dtypes_combination, numpy_cupy_allclose, numpy_cupy_array_almost_equal, + numpy_cupy_array_almost_equal_nulp, numpy_cupy_array_equal, + numpy_cupy_array_less, numpy_cupy_array_list_equal, + numpy_cupy_array_max_ulp, numpy_cupy_equal, - numpy_satisfies, - shaped_arange, - shaped_random, - shaped_reverse_arange, - with_requires, + numpy_cupy_raises, ) -from tests.third_party.cupy.testing.parameterized import ( - from_pytest_parameterize, +from tests.third_party.cupy.testing._parameterized import ( parameterize, - parameterize_pytest, product, product_dict, ) -from tests.third_party.cupy.testing.random import fix_random, generate_seed +from tests.third_party.cupy.testing._random import fix_random, generate_seed diff --git a/tests/third_party/cupy/testing/array.py b/tests/third_party/cupy/testing/_array.py similarity index 87% rename from tests/third_party/cupy/testing/array.py rename to tests/third_party/cupy/testing/_array.py index 55dd2783b7e3..bda9ac22eedb 100644 --- a/tests/third_party/cupy/testing/array.py +++ b/tests/third_party/cupy/testing/_array.py @@ -1,6 +1,6 @@ import numpy.testing -import dpnp +import dpnp as cupy # NumPy-like assertion functions that accept both NumPy and CuPy arrays @@ -22,10 +22,9 @@ def assert_allclose( .. seealso:: :func:`numpy.testing.assert_allclose` """ - numpy.testing.assert_allclose( - dpnp.asnumpy(actual), - dpnp.asnumpy(desired), + cupy.asnumpy(actual), + cupy.asnumpy(desired), rtol=rtol, atol=atol, err_msg=err_msg, @@ -45,12 +44,10 @@ def assert_array_almost_equal(x, y, decimal=6, err_msg="", verbose=True): values are appended to the error message. .. seealso:: :func:`numpy.testing.assert_array_almost_equal` - """ - numpy.testing.assert_array_almost_equal( - dpnp.asnumpy(x), - dpnp.asnumpy(y), + cupy.asnumpy(x), + cupy.asnumpy(y), decimal=decimal, err_msg=err_msg, verbose=verbose, @@ -68,7 +65,7 @@ def assert_array_almost_equal_nulp(x, y, nulp=1): .. seealso:: :func:`numpy.testing.assert_array_almost_equal_nulp` """ numpy.testing.assert_array_almost_equal_nulp( - dpnp.asnumpy(x), dpnp.asnumpy(y), nulp=nulp + cupy.asnumpy(x), cupy.asnumpy(y), nulp=nulp ) @@ -83,15 +80,15 @@ def assert_array_max_ulp(a, b, maxulp=1, dtype=None): dtype(numpy.dtype): Data-type to convert ``a`` and ``b`` to if given. .. seealso:: :func:`numpy.testing.assert_array_max_ulp` - """ - numpy.testing.assert_array_max_ulp( - dpnp.asnumpy(a), dpnp.asnumpy(b), maxulp=maxulp, dtype=dtype + cupy.asnumpy(a), cupy.asnumpy(b), maxulp=maxulp, dtype=dtype ) -def assert_array_equal(x, y, err_msg="", verbose=True, strides_check=False): +def assert_array_equal( + x, y, err_msg="", verbose=True, strides_check=False, **kwargs +): """Raises an AssertionError if two array_like objects are not equal. Args: @@ -102,11 +99,18 @@ def assert_array_equal(x, y, err_msg="", verbose=True, strides_check=False): err_msg(str): The error message to be printed in case of failure. verbose(bool): If ``True``, the conflicting values are appended to the error message. + strict(bool): If ``True``, raise an AssertionError when either + the shape or the data type of the array_like objects does not + match. Requires NumPy version 1.24 or above. .. seealso:: :func:`numpy.testing.assert_array_equal` """ numpy.testing.assert_array_equal( - dpnp.asnumpy(x), dpnp.asnumpy(y), err_msg=err_msg, verbose=verbose + cupy.asnumpy(x), + cupy.asnumpy(y), + err_msg=err_msg, + verbose=verbose, + **kwargs, ) if strides_check: @@ -155,7 +159,7 @@ def assert_array_list_equal(xlist, ylist, err_msg="", verbose=True): raise AssertionError("List size is different") for x, y in zip(xlist, ylist): numpy.testing.assert_array_equal( - dpnp.asnumpy(x), dpnp.asnumpy(y), err_msg=err_msg, verbose=verbose + cupy.asnumpy(x), cupy.asnumpy(y), err_msg=err_msg, verbose=verbose ) @@ -170,9 +174,7 @@ def assert_array_less(x, y, err_msg="", verbose=True): are appended to the error message. .. seealso:: :func:`numpy.testing.assert_array_less` - """ - numpy.testing.assert_array_less( - dpnp.asnumpy(x), dpnp.asnumpy(y), err_msg=err_msg, verbose=verbose + cupy.asnumpy(x), cupy.asnumpy(y), err_msg=err_msg, verbose=verbose ) diff --git a/tests/third_party/cupy/testing/_attr.py b/tests/third_party/cupy/testing/_attr.py new file mode 100644 index 000000000000..d2cd6605b217 --- /dev/null +++ b/tests/third_party/cupy/testing/_attr.py @@ -0,0 +1,45 @@ +import os + +from tests.third_party.cupy.testing._pytest_impl import ( + check_available, + is_available, +) + +if is_available(): + import pytest + + _gpu_limit = int(os.getenv("CUPY_TEST_GPU_LIMIT", "-1")) + + def slow(*args, **kwargs): + return pytest.mark.slow(*args, **kwargs) + +else: + + def _dummy_callable(*args, **kwargs): + check_available("pytest attributes") + assert False # Not reachable + + slow = _dummy_callable + + +def multi_gpu(gpu_num): + """Decorator to indicate number of GPUs required to run the test. + + Tests can be annotated with this decorator (e.g., ``@multi_gpu(2)``) to + declare number of GPUs required to run. When running tests, if + ``CUPY_TEST_GPU_LIMIT`` environment variable is set to value greater + than or equals to 0, test cases that require GPUs more than the limit will + be skipped. + """ + + check_available("multi_gpu attribute") + # at this point we know pytest is available for sure + + assert 1 < gpu_num + + def _wrapper(f): + return pytest.mark.skipif( + 0 <= _gpu_limit < gpu_num, reason="{} GPUs required".format(gpu_num) + )(pytest.mark.multi_gpu(f)) + + return _wrapper diff --git a/tests/third_party/cupy/testing/_bundle.py b/tests/third_party/cupy/testing/_bundle.py index 85e73f048ac3..687ba81f69c1 100644 --- a/tests/third_party/cupy/testing/_bundle.py +++ b/tests/third_party/cupy/testing/_bundle.py @@ -1,25 +1,6 @@ -import collections import inspect import sys -# A tuple that represents a test case. -# For bare (non-generated) test cases, [1] and [2] are None. -# [0] Test case class -# [1] Module name in whicn the class is defined -# [2] Class name -_TestCaseTuple = collections.namedtuple( - "_TestCaseTuple", ("klass", "module_name", "class_name") -) - - -class _ParameterizedTestCaseBundle(object): - def __init__(self, cases): - # cases is a list of _TestCaseTuple's - assert isinstance(cases, list) - assert all(isinstance(tup, _TestCaseTuple) for tup in cases) - - self.cases = cases - def make_decorator(test_case_generator): # `test_case_generator` is a callable that receives the source test class @@ -32,44 +13,25 @@ def make_decorator(test_case_generator): # The method generator is also a callable that receives an original test # method and returns a new test method. - def f(cases): - if isinstance(cases, _ParameterizedTestCaseBundle): - # The input is a parameterized test case. - cases = cases.cases - else: - # Input is a bare test case, i.e. not one generated from another - # parameterize. - cases = [_TestCaseTuple(cases, None, None)] - - generated_cases = [] - for klass, mod_name, cls_name in cases: - if mod_name is not None: - # The input is a parameterized test case. - # Remove it from its module. - delattr(sys.modules[mod_name], cls_name) - else: - # The input is a bare test case - mod_name = klass.__module__ + def f(cls): + # The input is a bare test case + module_name = cls.__module__ - # Generate parameterized test cases out of the input test case. - c = _generate_test_cases(mod_name, klass, test_case_generator) - generated_cases += c + # Generate parameterized test cases out of the input test case. + module = sys.modules[module_name] + assert module.__name__ == module_name + for cls_name, members, method_generator in test_case_generator(cls): + _generate_case(cls, module, cls_name, members, method_generator) - # Return the bundle of generated cases to allow repeated application of - # parameterize decorators. - return _ParameterizedTestCaseBundle(generated_cases) + # Remove original base class + return None return f def _generate_case(base, module, cls_name, mb, method_generator): - # Returns a _TestCaseTuple. - members = mb.copy() - # ismethod for Python 2 and isfunction for Python 3 - base_methods = inspect.getmembers( - base, predicate=lambda m: inspect.ismethod(m) or inspect.isfunction(m) - ) + base_methods = inspect.getmembers(base, predicate=inspect.isfunction) for name, value in base_methods: if not name.startswith("test_"): continue @@ -81,20 +43,5 @@ def _generate_case(base, module, cls_name, mb, method_generator): cls = type(cls_name, (base,), members) # Add new test class to module + cls.__module__ = module.__name__ setattr(module, cls_name, cls) - - return _TestCaseTuple(cls, module.__name__, cls_name) - - -def _generate_test_cases(module_name, base_class, test_case_generator): - # Returns a list of _TestCaseTuple's holding generated test cases. - module = sys.modules[module_name] - - generated_cases = [] - for cls_name, members, method_generator in test_case_generator(base_class): - c = _generate_case( - base_class, module, cls_name, members, method_generator - ) - generated_cases.append(c) - - return generated_cases diff --git a/tests/third_party/cupy/testing/_helper.py b/tests/third_party/cupy/testing/_helper.py new file mode 100644 index 000000000000..1afa9aa65e65 --- /dev/null +++ b/tests/third_party/cupy/testing/_helper.py @@ -0,0 +1,320 @@ +import contextlib +import inspect +import unittest +import warnings +from typing import Callable +from unittest import mock + +import numpy + +import dpnp as cupy +from tests.third_party.cupy.testing._pytest_impl import is_available + +# from cupy._core import internal +# import cupyx +# import cupyx.scipy.sparse + + +if is_available(): + import pytest + + _skipif: Callable[..., Callable[[Callable], Callable]] = pytest.mark.skipif +else: + _skipif = unittest.skipIf + + +def with_requires(*requirements): + """Run a test case only when given requirements are satisfied. + + .. admonition:: Example + + This test case runs only when `numpy>=1.18` is installed. + + >>> from cupy import testing + ... class Test(unittest.TestCase): + ... @testing.with_requires('numpy>=1.18') + ... def test_for_numpy_1_18(self): + ... pass + + Args: + requirements: A list of string representing requirement condition to + run a given test case. + + """ + msg = "requires: {}".format(",".join(requirements)) + return _skipif(not installed(requirements), reason=msg) + + +def installed(*specifiers): + """Returns True if the current environment satisfies the specified + package requirement. + + Args: + specifiers: Version specifiers (e.g., `numpy>=1.20.0`). + """ + # Delay import of pkg_resources because it is excruciatingly slow. + # See https://github.com/pypa/setuptools/issues/510 + import pkg_resources + + for spec in specifiers: + try: + pkg_resources.require(spec) + except pkg_resources.ResolutionError: + return False + return True + + +def numpy_satisfies(version_range): + """Returns True if numpy version satisfies the specified criteria. + + Args: + version_range: A version specifier (e.g., `>=1.13.0`). + """ + return installed("numpy{}".format(version_range)) + + +def shaped_arange(shape, xp=cupy, dtype=numpy.float32, order="C", device=None): + """Returns an array with given shape, array module, and dtype. + + Args: + shape(tuple of int): Shape of returned ndarray. + xp(numpy or cupy): Array module to use. + dtype(dtype): Dtype of returned ndarray. + order({'C', 'F'}): Order of returned ndarray. + device(None or device): A device where the output array is created. + + Returns: + numpy.ndarray or cupy.ndarray: + The array filled with :math:`1, \\cdots, N` with specified dtype + with given shape, array module. Here, :math:`N` is + the size of the returned array. + If ``dtype`` is ``numpy.bool_``, evens (resp. odds) are converted to + ``True`` (resp. ``False``). + + """ + dtype = numpy.dtype(dtype) + kw = {} if xp is numpy else {"device": device} + a = numpy.arange(1, numpy.prod(shape) + 1, 1) + if dtype == "?": + a = a % 2 == 0 + elif dtype.kind == "c": + a = a + a * 1j + return xp.array(a.astype(dtype).reshape(shape), order=order, **kw) + + +def shaped_reverse_arange(shape, xp=cupy, dtype=numpy.float32, device=None): + """Returns an array filled with decreasing numbers. + + Args: + shape(tuple of int): Shape of returned ndarray. + xp(numpy or cupy): Array module to use. + dtype(dtype): Dtype of returned ndarray. + device(None or device): A device where the output array is created. + + Returns: + numpy.ndarray or cupy.ndarray: + The array filled with :math:`N, \\cdots, 1` with specified dtype + with given shape, array module. + Here, :math:`N` is the size of the returned array. + If ``dtype`` is ``numpy.bool_``, evens (resp. odds) are converted to + ``True`` (resp. ``False``). + """ + dtype = numpy.dtype(dtype) + kw = {} if xp is numpy else {"device": device} + size = numpy.prod(shape) + a = numpy.arange(size, 0, -1) + if dtype == "?": + a = a % 2 == 0 + elif dtype.kind == "c": + a = a + a * 1j + return xp.array(a.astype(dtype).reshape(shape), **kw) + + +def shaped_random( + shape, xp=cupy, dtype=numpy.float32, scale=10, seed=0, order="C" +): + """Returns an array filled with random values. + + Args: + shape(tuple): Shape of returned ndarray. + xp(numpy or cupy): Array module to use. + dtype(dtype): Dtype of returned ndarray. + scale(float): Scaling factor of elements. + seed(int): Random seed. + + Returns: + numpy.ndarray or cupy.ndarray: The array with + given shape, array module, + + If ``dtype`` is ``numpy.bool_``, the elements are + independently drawn from ``True`` and ``False`` + with same probabilities. + Otherwise, the array is filled with samples + independently and identically drawn + from uniform distribution over :math:`[0, scale)` + with specified dtype. + """ + numpy.random.seed(seed) + dtype = numpy.dtype(dtype) + if dtype == "?": + a = numpy.random.randint(2, size=shape) + elif dtype.kind == "c": + a = numpy.random.rand(*shape) + 1j * numpy.random.rand(*shape) + a *= scale + else: + a = numpy.random.rand(*shape) * scale + return xp.asarray(a, dtype=dtype, order=order) + + +# def shaped_sparse_random( +# shape, sp=cupyx.scipy.sparse, dtype=numpy.float32, +# density=0.01, format='coo', seed=0): +# """Returns an array filled with random values. + +# Args: +# shape (tuple): Shape of returned sparse matrix. +# sp (scipy.sparse or cupyx.scipy.sparse): Sparce matrix module to use. +# dtype (dtype): Dtype of returned sparse matrix. +# density (float): Density of returned sparse matrix. +# format (str): Format of returned sparse matrix. +# seed (int): Random seed. + +# Returns: +# The sparse matrix with given shape, array module, +# """ +# import scipy.sparse +# n_rows, n_cols = shape +# numpy.random.seed(seed) +# a = scipy.sparse.random(n_rows, n_cols, density).astype(dtype) + +# if sp is cupyx.scipy.sparse: +# a = cupyx.scipy.sparse.coo_matrix(a) +# elif sp is not scipy.sparse: +# raise ValueError('Unknown module: {}'.format(sp)) + +# return a.asformat(format) + + +def generate_matrix( + shape, xp=cupy, dtype=numpy.float32, *, singular_values=None +): + r"""Returns a matrix with specified singular values. + + Generates a random matrix with given singular values. + This function generates a random NumPy matrix (or a stack of matrices) that + has specified singular values. It can be used to generate the inputs for a + test that can be instable when the input value behaves bad. + Notation: denote the shape of the generated array by :math:`(B..., M, N)`, + and :math:`K = min\{M, N\}`. :math:`B...` may be an empty sequence. + + Args: + shape (tuple of int): Shape of the generated array, i.e., + :math:`(B..., M, N)`. + xp (numpy or cupy): Array module to use. + dtype: Dtype of the generated array. + singular_values (array-like): Singular values of the generated + matrices. It must be broadcastable to shape :math:`(B..., K)`. + + Returns: + numpy.ndarray or cupy.ndarray: A random matrix that has specifiec + singular values. + """ + + if len(shape) <= 1: + raise ValueError( + "shape {} is invalid for matrices: too few axes".format(shape) + ) + + if singular_values is None: + raise TypeError("singular_values is not given") + singular_values = xp.asarray(singular_values) + + dtype = numpy.dtype(dtype) + if dtype.kind not in "fc": + raise TypeError("dtype {} is not supported".format(dtype)) + + if not xp.isrealobj(singular_values): + raise TypeError("singular_values is not real") + if (singular_values < 0).any(): + raise ValueError("negative singular value is given") + + # Generate random matrices with given singular values. We simply generate + # orthogonal vectors using SVD on random matrices and then combine them + # with the given singular values. + a = xp.random.randn(*shape) + if dtype.kind == "c": + a = a + 1j * xp.random.randn(*shape) + u, s, vh = xp.linalg.svd(a, full_matrices=False) + sv = xp.broadcast_to(singular_values, s.shape) + a = xp.einsum("...ik,...k,...kj->...ij", u, sv, vh) + return a.astype(dtype) + + +@contextlib.contextmanager +def assert_warns(expected): + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + yield + + if any(isinstance(m.message, expected) for m in w): + return + + try: + exc_name = expected.__name__ + except AttributeError: + exc_name = str(expected) + + raise AssertionError("%s not triggerred" % exc_name) + + +class NumpyAliasTestBase(unittest.TestCase): + @property + def func(self): + raise NotImplementedError() + + @property + def cupy_func(self): + return getattr(cupy, self.func) + + @property + def numpy_func(self): + return getattr(numpy, self.func) + + +class NumpyAliasBasicTestBase(NumpyAliasTestBase): + def test_argspec(self): + f = inspect.signature + assert f(self.cupy_func) == f(self.numpy_func) + + def test_docstring(self): + cupy_func = self.cupy_func + numpy_func = self.numpy_func + assert hasattr(cupy_func, "__doc__") + assert cupy_func.__doc__ is not None + assert cupy_func.__doc__ != "" + assert cupy_func.__doc__ is not numpy_func.__doc__ + + +class NumpyAliasValuesTestBase(NumpyAliasTestBase): + def test_values(self): + assert self.cupy_func(*self.args) == self.numpy_func(*self.args) + + +@contextlib.contextmanager +def assert_function_is_called(*args, times_called=1, **kwargs): + """A handy wrapper for unittest.mock to check if a function is called. + + Args: + *args: Arguments of `mock.patch`. + times_called (int): The number of times the function should be + called. Default is ``1``. + **kwargs: Keyword arguments of `mock.patch`. + + """ + with mock.patch(*args, **kwargs) as handle: + yield + assert handle.call_count == times_called + + +# TODO(kataoka): remove this alias +AssertFunctionIsCalled = assert_function_is_called diff --git a/tests/third_party/cupy/testing/hypothesis.py b/tests/third_party/cupy/testing/_hypothesis.py similarity index 100% rename from tests/third_party/cupy/testing/hypothesis.py rename to tests/third_party/cupy/testing/_hypothesis.py diff --git a/tests/third_party/cupy/testing/helper.py b/tests/third_party/cupy/testing/_loops.py similarity index 86% rename from tests/third_party/cupy/testing/helper.py rename to tests/third_party/cupy/testing/_loops.py index 3d239c273a60..d1833b977439 100644 --- a/tests/third_party/cupy/testing/helper.py +++ b/tests/third_party/cupy/testing/_loops.py @@ -1,4 +1,3 @@ -import contextlib import functools import inspect import os @@ -11,22 +10,12 @@ import numpy from dpctl import select_default_device -import dpnp import dpnp as cupy -import dpnp as cupyx +from tests.third_party.cupy.testing import _array, _parameterized +from tests.third_party.cupy.testing._pytest_impl import is_available -# from dpnp.core import internal -from tests.third_party.cupy.testing import array, parameterized - -# import dpnp -# import dpnp.scipy.sparse -from tests.third_party.cupy.testing.attr import is_available - - -def prod(args, init=1): - for arg in args: - init *= arg - return init +# import cupyx +# import cupyx.scipy.sparse if is_available(): @@ -574,7 +563,7 @@ def numpy_cupy_allclose( should return same value. >>> import unittest - >>> from cupy import testing + >>> from tests.third_party.cupy import testing >>> class TestFoo(unittest.TestCase): ... ... @testing.numpy_cupy_allclose() @@ -602,7 +591,7 @@ def numpy_cupy_allclose( def check_func(c, n): rtol1, atol1 = _resolve_tolerance(type_check, c, rtol, atol) - array.assert_allclose(c, n, rtol1, atol1, err_msg, verbose) + _array.assert_allclose(c, n, rtol1, atol1, err_msg, verbose) return _make_decorator( check_func, @@ -657,7 +646,7 @@ def numpy_cupy_array_almost_equal( """ def check_func(x, y): - array.assert_array_almost_equal(x, y, decimal, err_msg, verbose) + _array.assert_array_almost_equal(x, y, decimal, err_msg, verbose) return _make_decorator( check_func, name, type_check, False, accept_error, sp_name, scipy_name @@ -700,7 +689,7 @@ def numpy_cupy_array_almost_equal_nulp( """ def check_func(x, y): - array.assert_array_almost_equal_nulp(x, y, nulp) + _array.assert_array_almost_equal_nulp(x, y, nulp) return _make_decorator( check_func, @@ -754,7 +743,7 @@ def numpy_cupy_array_max_ulp( """ def check_func(x, y): - array.assert_array_max_ulp(x, y, maxulp, dtype) + _array.assert_array_max_ulp(x, y, maxulp, dtype) return _make_decorator( check_func, name, type_check, False, accept_error, sp_name, scipy_name @@ -803,7 +792,7 @@ def numpy_cupy_array_equal( """ def check_func(x, y): - array.assert_array_equal(x, y, err_msg, verbose, strides_check) + _array.assert_array_equal(x, y, err_msg, verbose, strides_check) return _make_decorator( check_func, name, type_check, False, accept_error, sp_name, scipy_name @@ -840,7 +829,7 @@ def numpy_cupy_array_list_equal( ) def check_func(x, y): - array.assert_array_equal(x, y, err_msg, verbose) + _array.assert_array_equal(x, y, err_msg, verbose) return _make_decorator( check_func, name, False, False, False, sp_name, scipy_name @@ -885,7 +874,7 @@ def numpy_cupy_array_less( """ def check_func(x, y): - array.assert_array_less(x, y, err_msg, verbose) + _array.assert_array_less(x, y, err_msg, verbose) return _make_decorator( check_func, name, type_check, False, accept_error, sp_name, scipy_name @@ -1064,22 +1053,6 @@ def _make_all_dtypes(no_float16, no_bool, no_complex): return (numpy.int64, numpy.int32) + _get_supported_float_dtypes() -# if no_float16: -# dtypes = _regular_float_dtypes -# else: -# dtypes = _float_dtypes -# -# if no_bool: -# dtypes += _int_dtypes -# else: -# dtypes += _int_bool_dtypes -# -# if not no_complex: -# dtypes += _complex_dtypes -# -# return dtypes - - def for_all_dtypes( name="dtype", no_float16=False, no_bool=False, no_complex=False ): @@ -1108,7 +1081,7 @@ def for_all_dtypes( ``dtype`` is an argument inserted by the decorator. >>> import unittest - >>> from cupy import testing + >>> from tests.third_party.cupy import testing >>> class TestNpz(unittest.TestCase): ... ... @testing.for_all_dtypes() @@ -1124,7 +1097,7 @@ def for_all_dtypes( The following is such an example. >>> import unittest - >>> from cupy import testing + >>> from tests.third_party.cupy import testing >>> class TestMean(unittest.TestCase): ... ... @testing.for_all_dtypes() @@ -1176,7 +1149,7 @@ def for_signed_dtypes(name="dtype"): def for_unsigned_dtypes(name="dtype"): - """Decorator that checks the fixture with unsigned dtypes. + """Decorator that checks the fixture with unsinged dtypes. Args: name(str): Argument name to which specified dtypes are passed. @@ -1263,7 +1236,7 @@ def for_dtypes_combination(types, names=("dtype",), full=None): full = int(os.environ.get("CUPY_TEST_FULL_COMBINATION", "0")) != 0 if full: - combination = parameterized.product({name: types for name in names}) + combination = _parameterized.product({name: types for name in names}) else: ts = [] for _ in range(len(names)): @@ -1500,213 +1473,3 @@ def test_func(self, *args, **kw): return test_func return decorator - - -def with_requires(*requirements): - """Run a test case only when given requirements are satisfied. - - .. admonition:: Example - - This test case runs only when `numpy>=1.18` is installed. - - >>> from dpnp import testing - ... class Test(unittest.TestCase): - ... @testing.with_requires('numpy>=1.18') - ... def test_for_numpy_1_18(self): - ... pass - - Args: - requirements: A list of string representing requirement condition to - run a given test case. - - """ - # Delay import of pkg_resources because it is excruciatingly slow. - # See https://github.com/pypa/setuptools/issues/510 - import pkg_resources - - ws = pkg_resources.WorkingSet() - try: - ws.require(*requirements) - skip = False - except pkg_resources.ResolutionError: - skip = True - - msg = "requires: {}".format(",".join(requirements)) - return unittest.skipIf(skip, msg) - - -def numpy_satisfies(version_range): - """Returns True if numpy version satisfies the specified criteria. - - Args: - version_range: A version specifier (e.g., `>=1.13.0`). - """ - # Delay import of pkg_resources because it is excruciatingly slow. - # See https://github.com/pypa/setuptools/issues/510 - import pkg_resources - - spec = "numpy{}".format(version_range) - try: - pkg_resources.require(spec) - except pkg_resources.VersionConflict: - return False - return True - - -def shaped_arange(shape, xp=cupy, dtype=numpy.float32, order="C", device=None): - """Returns an array with given shape, array module, and dtype. - - Args: - shape(tuple of int): Shape of returned ndarray. - xp(numpy or cupy): Array module to use. - dtype(dtype): Dtype of returned ndarray. - order({'C', 'F'}): Order of returned ndarray. - device(None or device): A device where the output array is created. - - Returns: - numpy.ndarray or cupy.ndarray: - The array filled with :math:`1, \\cdots, N` with specified dtype - with given shape, array module. Here, :math:`N` is - the size of the returned array. - If ``dtype`` is ``numpy.bool_``, evens (resp. odds) are converted to - ``True`` (resp. ``False``). - - """ - dtype = numpy.dtype(dtype) - kw = {} if xp is numpy else {"device": device} - a = numpy.arange(1, prod(shape) + 1, 1) - if dtype == "?": - a = a % 2 == 0 - elif dtype.kind == "c": - a = a + a * 1j - return xp.array(a.astype(dtype).reshape(shape), order=order, **kw) - - -def shaped_reverse_arange(shape, xp=cupy, dtype=numpy.float32, device=None): - """Returns an array filled with decreasing numbers. - - Args: - shape(tuple of int): Shape of returned ndarray. - xp(numpy or cupy): Array module to use. - dtype(dtype): Dtype of returned ndarray. - device(None or device): A device where the output array is created. - - Returns: - numpy.ndarray or cupy.ndarray: - The array filled with :math:`N, \\cdots, 1` with specified dtype - with given shape, array module. - Here, :math:`N` is the size of the returned array. - If ``dtype`` is ``numpy.bool_``, evens (resp. odds) are converted to - ``True`` (resp. ``False``). - """ - dtype = numpy.dtype(dtype) - kw = {} if xp is numpy else {"device": device} - size = prod(shape) - a = numpy.arange(size, 0, -1) - if dtype == "?": - a = a % 2 == 0 - elif dtype.kind == "c": - a = a + a * 1j - return xp.array(a.astype(dtype).reshape(shape), **kw) - - -def shaped_random( - shape, xp=cupy, dtype=numpy.float32, scale=10, seed=0, order="C" -): - """Returns an array filled with random values. - - Args: - shape(tuple): Shape of returned ndarray. - xp(numpy or cupy): Array module to use. - dtype(dtype): Dtype of returned ndarray. - scale(float): Scaling factor of elements. - seed(int): Random seed. - - Returns: - numpy.ndarray or cupy.ndarray: The array with - given shape, array module, - - If ``dtype`` is ``numpy.bool_``, the elements are - independently drawn from ``True`` and ``False`` - with same probabilities. - Otherwise, the array is filled with samples - independently and identically drawn - from uniform distribution over :math:`[0, scale)` - with specified dtype. - """ - numpy.random.seed(seed) - dtype = numpy.dtype(dtype) - if dtype == "?": - a = numpy.random.randint(2, size=shape) - elif dtype.kind == "c": - a = numpy.random.rand(*shape) + 1j * numpy.random.rand(*shape) - a *= scale - else: - a = numpy.random.rand(*shape) * scale - return xp.asarray(a, dtype=dtype, order=order) - - -def empty(xp=dpnp, dtype=numpy.float64): - return xp.zeros((0,)) - - -class NumpyError(object): - def __init__(self, **kw): - self.kw = kw - - def __enter__(self): - self.err = numpy.geterr() - numpy.seterr(**self.kw) - - def __exit__(self, *_): - numpy.seterr(**self.err) - - -@contextlib.contextmanager -def assert_warns(expected): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - yield - - if any(isinstance(m.message, expected) for m in w): - return - - try: - exc_name = expected.__name__ - except AttributeError: - exc_name = str(expected) - - raise AssertionError("%s not triggerred" % exc_name) - - -class NumpyAliasTestBase(unittest.TestCase): - @property - def func(self): - raise NotImplementedError() - - @property - def cupy_func(self): - return getattr(cupy, self.func) - - @property - def numpy_func(self): - return getattr(numpy, self.func) - - -class NumpyAliasBasicTestBase(NumpyAliasTestBase): - def test_argspec(self): - f = inspect.signature - assert f(self.cupy_func) == f(self.numpy_func) - - def test_docstring(self): - cupy_func = self.cupy_func - numpy_func = self.numpy_func - assert hasattr(cupy_func, "__doc__") - assert cupy_func.__doc__ is not None - assert cupy_func.__doc__ != "" - assert cupy_func.__doc__ is not numpy_func.__doc__ - - -class NumpyAliasValuesTestBase(NumpyAliasTestBase): - def test_values(self): - assert self.cupy_func(*self.args) == self.numpy_func(*self.args) diff --git a/tests/third_party/cupy/testing/_parameterized.py b/tests/third_party/cupy/testing/_parameterized.py new file mode 100644 index 000000000000..b965d1c3068c --- /dev/null +++ b/tests/third_party/cupy/testing/_parameterized.py @@ -0,0 +1,119 @@ +import itertools +import types +import unittest + +from tests.third_party.cupy.testing import _bundle, _pytest_impl + + +def _param_to_str(obj): + if isinstance(obj, type): + return obj.__name__ + elif hasattr(obj, "__name__") and isinstance(obj.__name__, str): + # print __name__ attribute for classes, functions and modules + return obj.__name__ + return repr(obj) + + +def _shorten(s, maxlen): + # Shortens the string down to maxlen, by replacing the middle part with + # a 3-dots string '...'. + ellipsis = "..." + if len(s) <= maxlen: + return s + n1 = (maxlen - len(ellipsis)) // 2 + n2 = maxlen - len(ellipsis) - n1 + s = s[:n1] + ellipsis + s[-n2:] + assert len(s) == maxlen + return s + + +def _make_class_name(base_class_name, i_param, param): + # Creates a class name for a single combination of parameters. + SINGLE_PARAM_MAXLEN = 100 # Length limit of a single parameter value + PARAMS_MAXLEN = 5000 # Length limit of the whole parameters part + param_strs = [ + "{}={}".format(k, _shorten(_param_to_str(v), SINGLE_PARAM_MAXLEN)) + for k, v in sorted(param.items()) + ] + param_strs = _shorten(", ".join(param_strs), PARAMS_MAXLEN) + cls_name = "{}_param_{}_{{{}}}".format(base_class_name, i_param, param_strs) + return cls_name + + +def _parameterize_test_case_generator(base, params): + # Defines the logic to generate parameterized test case classes. + + for i, param in enumerate(params): + yield _parameterize_test_case(base, i, param) + + +def _parameterize_test_case(base, i, param): + cls_name = _make_class_name(base.__name__, i, param) + + def __repr__(self): + name = base.__repr__(self) + return "<%s parameter: %s>" % (name, param) + + mb = {"__repr__": __repr__} + for k, v in sorted(param.items()): + if isinstance(v, types.FunctionType): + + def create_new_v(): + f = v + + def new_v(self, *args, **kwargs): + return f(*args, **kwargs) + + return new_v + + mb[k] = create_new_v() + else: + mb[k] = v + + return (cls_name, mb, lambda method: method) + + +def parameterize(*params, **kwargs): + """Generates test classes with given sets of additional attributes + + >>> @parameterize({"a": 1}, {"b": 2, "c": 3}) + ... class TestX(unittest.TestCase): + ... def test_y(self): + ... pass + + generates two classes `TestX_param_0_...`, `TestX_param_1_...` and + removes the original class `TestX`. + + The specification is subject to change, which applies to all the non-NumPy + `testing` features. + + """ + + def f(cls): + if issubclass(cls, unittest.TestCase): + assert not kwargs + deco = _bundle.make_decorator( + lambda base: _parameterize_test_case_generator(base, params) + ) + else: + deco = _pytest_impl.parameterize(*params, **kwargs) + return deco(cls) + + return f + + +def product(parameter): + # TODO(kataoka): Add documentation + assert isinstance(parameter, dict) + keys = sorted(parameter) + values = [parameter[key] for key in keys] + values_product = itertools.product(*values) + return [dict(zip(keys, vals)) for vals in values_product] + + +def product_dict(*parameters): + # TODO(kataoka): Add documentation + return [ + {k: v for dic in dicts for k, v in dic.items()} + for dicts in itertools.product(*parameters) + ] diff --git a/tests/third_party/cupy/testing/_pytest_impl.py b/tests/third_party/cupy/testing/_pytest_impl.py new file mode 100644 index 000000000000..9e6d0f579333 --- /dev/null +++ b/tests/third_party/cupy/testing/_pytest_impl.py @@ -0,0 +1,79 @@ +import unittest + +import tests.third_party.cupy.testing._parameterized + +try: + import _pytest + import pytest + + _error = None +except ImportError as e: + pytest = None + _pytest = None + _error = e + + +def is_available(): + return _error is None and hasattr(pytest, "fixture") + + +def check_available(feature): + if not is_available(): + raise RuntimeError( + """\ +cupy.testing: {} is not available. + +Reason: {}: {}""".format( + feature, type(_error).__name__, _error + ) + ) + + +if is_available(): + + class _TestingParameterizeMixin: + def __repr__(self): + return "<{} parameter: {}>".format( + super().__repr__(), + self.__dict__, + ) + + @pytest.fixture(autouse=True) + def _cupy_testing_parameterize(self, _cupy_testing_param): + assert ( + not self.__dict__ + ), "There should not be another hack with instance attribute." + self.__dict__.update(_cupy_testing_param) + + +def parameterize(*params, _ids=True): + check_available("parameterize") + if _ids: + param_name = ( + tests.third_party.cupy.testing._parameterized._make_class_name + ) + else: + + def param_name(_, i, param): + return str(i) + + # TODO(kataoka): Give better names (`id`). + # For now, use legacy `_make_class_name` just for consistency. Here, + # a generated name is `TestFoo::test_bar[_param_0_{...}]`, whereas + # a legacy name is `TestFoo_param_0_{...}::test_bar + params = [ + pytest.param(param, id=param_name("", i, param)) + for i, param in enumerate(params) + ] + + def f(cls): + assert not issubclass(cls, unittest.TestCase) + if issubclass(cls, _TestingParameterizeMixin): + raise RuntimeError("do not `@testing.parameterize` twice") + module_name = cls.__module__ + cls = type(cls.__name__, (_TestingParameterizeMixin, cls), {}) + cls.__module__ = module_name + cls = pytest.mark.parametrize("_cupy_testing_param", params)(cls) + return cls + + return f diff --git a/tests/third_party/cupy/testing/random.py b/tests/third_party/cupy/testing/_random.py similarity index 96% rename from tests/third_party/cupy/testing/random.py rename to tests/third_party/cupy/testing/_random.py index ecc299737c09..a4dc897bb9cc 100644 --- a/tests/third_party/cupy/testing/random.py +++ b/tests/third_party/cupy/testing/_random.py @@ -94,12 +94,12 @@ def fix_random(): """Decorator that fixes random numbers in a test. This decorator can be applied to either a test case class or a test method. - It should not be applied within ``_condition.retry`` or - ``_condition.repeat``. + It should not be applied within ``condition.retry`` or + ``condition.repeat``. """ # TODO(niboshi): Prevent this decorator from being applied within - # _condition.repeat or _condition.retry decorators. That would repeat + # condition.repeat or condition.retry decorators. That would repeat # tests with the same random seeds. It's okay to apply this outside # these decorators. diff --git a/tests/third_party/cupy/testing/attr.py b/tests/third_party/cupy/testing/attr.py deleted file mode 100644 index b927c9e298f5..000000000000 --- a/tests/third_party/cupy/testing/attr.py +++ /dev/null @@ -1,75 +0,0 @@ -import os -import unittest - -try: - import pytest - - _error = None -except ImportError as e: - _error = e - - -def is_available(): - return _error is None - - -def check_available(): - if _error is not None: - raise RuntimeError( - """\ -{} is not available. - -Reason: {}: {}""".format( - __name__, type(_error).__name__, _error - ) - ) - - -def get_error(): - return _error - - -if _error is None: - _gpu_limit = int(os.getenv("CUPY_TEST_GPU_LIMIT", "-1")) - - def cudnn(*args, **kwargs): - return pytest.mark.cudnn(*args, **kwargs) - - def slow(*args, **kwargs): - return pytest.mark.slow(*args, **kwargs) - -else: - - def _dummy_callable(*args, **kwargs): - check_available() - assert False # Not reachable - - cudnn = _dummy_callable - slow = _dummy_callable - - -def multi_gpu(gpu_num): - """Decorator to indicate number of GPUs required to run the test. - - Tests can be annotated with this decorator (e.g., ``@multi_gpu(2)``) to - declare number of GPUs required to run. When running tests, if - ``CUPY_TEST_GPU_LIMIT`` environment variable is set to value greater - than or equals to 0, test cases that require GPUs more than the limit will - be skipped. - """ - - check_available() - return unittest.skipIf( - 0 <= _gpu_limit < gpu_num, reason="{} GPUs required".format(gpu_num) - ) - - -def gpu(f): - """Decorator to indicate that GPU is required to run the test. - - Tests can be annotated with this decorator (e.g., ``@gpu``) to - declare that one GPU is required to run. - """ - - check_available() - return multi_gpu(1)(f) diff --git a/tests/third_party/cupy/testing/parameterized.py b/tests/third_party/cupy/testing/parameterized.py deleted file mode 100644 index 62ded147503a..000000000000 --- a/tests/third_party/cupy/testing/parameterized.py +++ /dev/null @@ -1,167 +0,0 @@ -import functools -import io -import itertools -import types -import unittest - -from tests.third_party.cupy.testing import _bundle - - -def _param_to_str(obj): - if isinstance(obj, type): - return obj.__name__ - elif hasattr(obj, "__name__") and isinstance(obj.__name__, str): - # print __name__ attribute for classes, functions and modules - return obj.__name__ - return repr(obj) - - -def _shorten(s, maxlen): - # Shortens the string down to maxlen, by replacing the middle part with - # a 3-dots string '...'. - ellipsis = "..." - if len(s) <= maxlen: - return s - n1 = (maxlen - len(ellipsis)) // 2 - n2 = maxlen - len(ellipsis) - n1 - s = s[:n1] + ellipsis + s[-n2:] - assert len(s) == maxlen - return s - - -def _make_class_name(base_class_name, i_param, param): - # Creates a class name for a single combination of parameters. - SINGLE_PARAM_MAXLEN = 100 # Length limit of a single parameter value - PARAMS_MAXLEN = 5000 # Length limit of the whole parameters part - param_strs = [ - "{}={}".format(k, _shorten(_param_to_str(v), SINGLE_PARAM_MAXLEN)) - for k, v in sorted(param.items()) - ] - param_strs = _shorten(", ".join(param_strs), PARAMS_MAXLEN) - cls_name = "{}_param_{}_{{{}}}".format(base_class_name, i_param, param_strs) - return cls_name - - -def _parameterize_test_case_generator(base, params): - # Defines the logic to generate parameterized test case classes. - - for i, param in enumerate(params): - yield _parameterize_test_case(base, i, param) - - -def _parameterize_test_case(base, i, param): - cls_name = _make_class_name(base.__name__, i, param) - - def __str__(self): - name = base.__str__(self) - return "%s parameter: %s" % (name, param) - - mb = {"__str__": __str__} - for k, v in sorted(param.items()): - if isinstance(v, types.FunctionType): - - def create_new_v(): - f = v - - def new_v(self, *args, **kwargs): - return f(*args, **kwargs) - - return new_v - - mb[k] = create_new_v() - else: - mb[k] = v - - def method_generator(base_method): - # Generates a wrapped test method - - @functools.wraps(base_method) - def new_method(self, *args, **kwargs): - try: - return base_method(self, *args, **kwargs) - except unittest.SkipTest: - raise - except Exception as e: - s = io.StringIO() - s.write("Parameterized test failed.\n\n") - s.write( - "Base test method: {}.{}\n".format( - base.__name__, base_method.__name__ - ) - ) - s.write("Test parameters:\n") - for k, v in sorted(param.items()): - s.write(" {}: {}\n".format(k, v)) - raise e.__class__(s.getvalue()).with_traceback(e.__traceback__) - - return new_method - - return (cls_name, mb, method_generator) - - -def parameterize(*params): - # TODO(niboshi): Add documentation - return _bundle.make_decorator( - lambda base: _parameterize_test_case_generator(base, params) - ) - - -def _values_to_dicts(names, values): - assert isinstance(names, str) - assert isinstance(values, (tuple, list)) - - def safe_zip(ns, vs): - if len(ns) == 1: - return [(ns[0], vs)] - assert isinstance(vs, (tuple, list)) and len(ns) == len(vs) - return zip(ns, vs) - - names = names.split(",") - params = [dict(safe_zip(names, value_list)) for value_list in values] - return params - - -def from_pytest_parameterize(names, values): - # Pytest-style parameterization. - # TODO(niboshi): Add documentation - return _values_to_dicts(names, values) - - -def parameterize_pytest(names, values): - # Pytest-style parameterization. - # TODO(niboshi): Add documentation - return parameterize(*from_pytest_parameterize(names, values)) - - -def product(parameter): - # TODO(niboshi): Add documentation - if isinstance(parameter, dict): - return product_dict( - *[ - _values_to_dicts(names, values) - for names, values in sorted(parameter.items()) - ] - ) - - elif isinstance(parameter, list): - # list of lists of dicts - if not all(isinstance(_, list) for _ in parameter): - raise TypeError("parameter must be list of lists of dicts") - if not all(isinstance(_, dict) for l in parameter for _ in l): - raise TypeError("parameter must be list of lists of dicts") - return product_dict(*parameter) - - else: - raise TypeError( - "parameter must be either dict or list. Actual: {}".format( - type(parameter) - ) - ) - - -def product_dict(*parameters): - # TODO(niboshi): Add documentation - return [ - {k: v for dic in dicts for k, v in dic.items()} - for dicts in itertools.product(*parameters) - ] From c97ff8c94bc7f05002acec0c42e0a9ca3ca2f0bb Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Wed, 20 Mar 2024 20:22:49 +0100 Subject: [PATCH 2/4] Updated names of skipped tests based on new f/w rules --- tests/skipped_tests.tbl | 35 ++++++++++++++++++--------------- tests/skipped_tests_gpu.tbl | 39 ++++++++++++++++++++----------------- tests/test_linalg.py | 2 +- 3 files changed, 41 insertions(+), 35 deletions(-) diff --git a/tests/skipped_tests.tbl b/tests/skipped_tests.tbl index ffd34cbf47dd..6a900fda666f 100644 --- a/tests/skipped_tests.tbl +++ b/tests/skipped_tests.tbl @@ -705,22 +705,25 @@ tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_bo tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_goodness_of_fit tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_goodness_of_fit_2 -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_0_{func='argmin', is_module=True, shape=(3, 4)}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_1_{func='argmin', is_module=True, shape=()}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_2_{func='argmin', is_module=False, shape=(3, 4)}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_3_{func='argmin', is_module=False, shape=()}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_4_{func='argmax', is_module=True, shape=(3, 4)}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_5_{func='argmax', is_module=True, shape=()}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_6_{func='argmax', is_module=False, shape=(3, 4)}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_7_{func='argmax', is_module=False, shape=()}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgwhere_param_0_{array=array([], dtype=float64)}::test_argwhere -tests/third_party/cupy/sorting_tests/test_search.py::TestArgwhere_param_1_{array=array([], shape=(0, 2), dtype=float64)}::test_argwhere -tests/third_party/cupy/sorting_tests/test_search.py::TestArgwhere_param_2_{array=array([], shape=(0, 2, 0), dtype=float64)}::test_argwhere -tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero_param_0_{array=array(0)}::test_flatnonzero -tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero_param_1_{array=array(1)}::test_flatnonzero -tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero_param_2_{array=array([], dtype=float64)}::test_flatnonzero -tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero_param_3_{array=array([], shape=(0, 2), dtype=float64)}::test_flatnonzero -tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero_param_4_{array=array([], shape=(0, 2, 0), dtype=float64)}::test_flatnonzero +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_0_{func='argmin', is_module=True, shape=(3, 4)}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_1_{func='argmin', is_module=True, shape=()}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_2_{func='argmin', is_module=False, shape=(3, 4)}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_3_{func='argmin', is_module=False, shape=()}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_4_{func='argmax', is_module=True, shape=(3, 4)}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_5_{func='argmax', is_module=True, shape=()}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_6_{func='argmax', is_module=False, shape=(3, 4)}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_7_{func='argmax', is_module=False, shape=()}] + +tests/third_party/cupy/sorting_tests/test_search.py::TestArgwhere::test_argwhere[0] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgwhere::test_argwhere[1] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgwhere::test_argwhere[2] + +tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero::test_flatnonzero[0] +tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero::test_flatnonzero[1] +tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero::test_flatnonzero[2] +tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero::test_flatnonzero[3] +tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero::test_flatnonzero[4] + tests/third_party/cupy/sorting_tests/test_search.py::TestNonzeroZeroDimension_param_0_{array=array(0)}::test_nonzero tests/third_party/cupy/sorting_tests/test_search.py::TestNonzeroZeroDimension_param_1_{array=array(1)}::test_nonzero diff --git a/tests/skipped_tests_gpu.tbl b/tests/skipped_tests_gpu.tbl index 436496bfc196..cae7e25765e5 100644 --- a/tests/skipped_tests_gpu.tbl +++ b/tests/skipped_tests_gpu.tbl @@ -191,8 +191,6 @@ tests/third_party/cupy/core_tests/test_ndarray_copy_and_view.py::TestArrayFlatte tests/third_party/cupy/core_tests/test_ndarray_copy_and_view.py::TestArrayFlatten::test_flatten_order_copied tests/third_party/cupy/core_tests/test_ndarray_copy_and_view.py::TestArrayFlatten::test_flatten_order_transposed - - tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_0_{order='C', shape=(10,)}::test_cub_max tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_0_{order='C', shape=(10,)}::test_cub_min tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_1_{order='C', shape=(10, 20)}::test_cub_max @@ -315,6 +313,7 @@ tests/third_party/cupy/indexing_tests/test_indexing.py::TestIndexing::test_diago tests/third_party/cupy/indexing_tests/test_indexing.py::TestIndexing::test_diagonal_negative3 tests/third_party/cupy/indexing_tests/test_indexing.py::TestIndexing::test_diagonal_negative4 tests/third_party/cupy/indexing_tests/test_indexing.py::TestIndexing::test_diagonal_negative5 + tests/third_party/cupy/indexing_tests/test_insert.py::TestDiagIndicesFromRaises_param_4_{shape=(-1,)}::test_non_equal_dims tests/third_party/cupy/indexing_tests/test_insert.py::TestFillDiagonal_param_0_{shape=(3, 3), val=1, wrap=True}::test_columnar_slice tests/third_party/cupy/indexing_tests/test_insert.py::TestFillDiagonal_param_11_{shape=(2, 2, 2), val=0, wrap=False}::test_1darray @@ -350,6 +349,7 @@ tests/third_party/cupy/indexing_tests/test_insert.py::TestFillDiagonal_param_7_{ tests/third_party/cupy/indexing_tests/test_insert.py::TestFillDiagonal_param_9_{shape=(2, 2, 2), val=1, wrap=False}::test_1darray tests/third_party/cupy/indexing_tests/test_insert.py::TestPutmaskDifferentDtypes::test_putmask_differnt_dtypes_raises tests/third_party/cupy/indexing_tests/test_insert.py::TestPutmask::test_putmask_non_equal_shape_raises + tests/third_party/cupy/indexing_tests/test_iterate.py::TestFlatiter::test_next tests/third_party/cupy/indexing_tests/test_iterate.py::TestFlatiter::test_iter tests/third_party/cupy/indexing_tests/test_iterate.py::TestFlatiterSubscript_param_1_{index=0, shape=(2, 3, 4)}::test_setitem_scalar @@ -767,22 +767,25 @@ tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_bo tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_goodness_of_fit tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_goodness_of_fit_2 -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_0_{func='argmin', is_module=True, shape=(3, 4)}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_1_{func='argmin', is_module=True, shape=()}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_2_{func='argmin', is_module=False, shape=(3, 4)}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_3_{func='argmin', is_module=False, shape=()}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_4_{func='argmax', is_module=True, shape=(3, 4)}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_5_{func='argmax', is_module=True, shape=()}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_6_{func='argmax', is_module=False, shape=(3, 4)}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype_param_7_{func='argmax', is_module=False, shape=()}::test_argminmax_dtype -tests/third_party/cupy/sorting_tests/test_search.py::TestArgwhere_param_0_{array=array([], dtype=float64)}::test_argwhere -tests/third_party/cupy/sorting_tests/test_search.py::TestArgwhere_param_1_{array=array([], shape=(0, 2), dtype=float64)}::test_argwhere -tests/third_party/cupy/sorting_tests/test_search.py::TestArgwhere_param_2_{array=array([], shape=(0, 2, 0), dtype=float64)}::test_argwhere -tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero_param_0_{array=array(0)}::test_flatnonzero -tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero_param_1_{array=array(1)}::test_flatnonzero -tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero_param_2_{array=array([], dtype=float64)}::test_flatnonzero -tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero_param_3_{array=array([], shape=(0, 2), dtype=float64)}::test_flatnonzero -tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero_param_4_{array=array([], shape=(0, 2, 0), dtype=float64)}::test_flatnonzero +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_0_{func='argmin', is_module=True, shape=(3, 4)}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_1_{func='argmin', is_module=True, shape=()}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_2_{func='argmin', is_module=False, shape=(3, 4)}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_3_{func='argmin', is_module=False, shape=()}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_4_{func='argmax', is_module=True, shape=(3, 4)}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_5_{func='argmax', is_module=True, shape=()}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_6_{func='argmax', is_module=False, shape=(3, 4)}] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgMinMaxDtype::test_argminmax_dtype[_param_7_{func='argmax', is_module=False, shape=()}] + +tests/third_party/cupy/sorting_tests/test_search.py::TestArgwhere::test_argwhere[0] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgwhere::test_argwhere[1] +tests/third_party/cupy/sorting_tests/test_search.py::TestArgwhere::test_argwhere[2] + +tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero::test_flatnonzero[0] +tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero::test_flatnonzero[1] +tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero::test_flatnonzero[2] +tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero::test_flatnonzero[3] +tests/third_party/cupy/sorting_tests/test_search.py::TestFlatNonzero::test_flatnonzero[4] + tests/third_party/cupy/sorting_tests/test_search.py::TestNonzeroZeroDimension_param_0_{array=array(0)}::test_nonzero tests/third_party/cupy/sorting_tests/test_search.py::TestNonzeroZeroDimension_param_1_{array=array(1)}::test_nonzero diff --git a/tests/test_linalg.py b/tests/test_linalg.py index 65cfa949db01..9decfd0f018f 100644 --- a/tests/test_linalg.py +++ b/tests/test_linalg.py @@ -387,7 +387,7 @@ def test_eig_arange(type, size): @pytest.mark.parametrize("type", get_all_dtypes(no_bool=True, no_none=True)) @pytest.mark.parametrize("size", [2, 4, 8]) def test_eigh_arange(type, size): - if dpctl.get_current_device_type() != dpctl.device_type.gpu: + if dpctl.SyclDevice().device_type != dpctl.device_type.gpu: pytest.skip( "eig function doesn't work on CPU: https://github.com/IntelPython/dpnp/issues/1005" ) From 1ad55f134a5de857e404b75457ef15bd0721b998 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Thu, 21 Mar 2024 12:01:49 +0100 Subject: [PATCH 3/4] Replaced removed dpctl.get_current_device_type() call --- tests/test_linalg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_linalg.py b/tests/test_linalg.py index 9decfd0f018f..d42e17441001 100644 --- a/tests/test_linalg.py +++ b/tests/test_linalg.py @@ -429,7 +429,7 @@ def test_eigh_arange(type, size): @pytest.mark.parametrize("type", get_all_dtypes(no_bool=True, no_complex=True)) def test_eigvals(type): - if dpctl.get_current_device_type() != dpctl.device_type.gpu: + if dpctl.SyclDevice().device_type != dpctl.device_type.gpu: pytest.skip( "eigvals function doesn't work on CPU: https://github.com/IntelPython/dpnp/issues/1005" ) From 8a5a81c9d18019358d19d8e75504045a458a2391 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Fri, 22 Mar 2024 10:11:25 +0100 Subject: [PATCH 4/4] Applied review comments --- tests/third_party/cupy/core_tests/test_ndarray_reduction.py | 1 - tests/third_party/cupy/random_tests/test_sample.py | 2 -- tests/third_party/cupy/sorting_tests/test_search.py | 1 - 3 files changed, 4 deletions(-) diff --git a/tests/third_party/cupy/core_tests/test_ndarray_reduction.py b/tests/third_party/cupy/core_tests/test_ndarray_reduction.py index c0e344b3a7ca..5a45278f7daf 100644 --- a/tests/third_party/cupy/core_tests/test_ndarray_reduction.py +++ b/tests/third_party/cupy/core_tests/test_ndarray_reduction.py @@ -394,7 +394,6 @@ def test_zero_size(self, xp): } ) ) - # @unittest.skipUnless(cupy.cuda.cub.available, 'The CUB routine is not enabled') class TestCubReduction(unittest.TestCase): # def setUp(self): diff --git a/tests/third_party/cupy/random_tests/test_sample.py b/tests/third_party/cupy/random_tests/test_sample.py index d26d39eb1ba9..532f4f122f4b 100644 --- a/tests/third_party/cupy/random_tests/test_sample.py +++ b/tests/third_party/cupy/random_tests/test_sample.py @@ -39,8 +39,6 @@ def test_zero_sizes(self): # @testing.fix_random() - - class TestRandint2(unittest.TestCase): @pytest.mark.usefixtures("allow_fall_back_on_numpy") @_condition.repeat(3, 10) diff --git a/tests/third_party/cupy/sorting_tests/test_search.py b/tests/third_party/cupy/sorting_tests/test_search.py index 5e0af865a5e8..875fa071f1a1 100644 --- a/tests/third_party/cupy/sorting_tests/test_search.py +++ b/tests/third_party/cupy/sorting_tests/test_search.py @@ -165,7 +165,6 @@ def test_argmin_zero_size_axis1(self, xp, dtype): # 'shape': [(10,), (10, 20), (10, 20, 30), (10, 20, 30, 40)], # 'order': ('C', 'F'), # })) - # @unittest.skipUnless(cupy.cuda.cub.available, 'The CUB routine is not enabled') # class TestCubReduction(unittest.TestCase):