From 579d999653bbc989f39c9990229c5c92c9fe09ff Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Tue, 4 Apr 2023 13:48:34 -0500 Subject: [PATCH] [pytest] Don't return values from test_* functions (#14475) * [pytest] Don't return values from test_* functions Pytest expects test functions to return None, and errors to be flagged via exceptions. It actually emits warnings for "return" statements encountered in test_ functions. * Add explicit asserts * Use not-None in assertion --- tests/python/contrib/test_hexagon/test_2d_physical_buffers.py | 2 +- tests/python/contrib/test_hexagon/test_maxpool2d_blocked.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/python/contrib/test_hexagon/test_2d_physical_buffers.py b/tests/python/contrib/test_hexagon/test_2d_physical_buffers.py index 4aa12aedf215..d22b2db9c399 100644 --- a/tests/python/contrib/test_hexagon/test_2d_physical_buffers.py +++ b/tests/python/contrib/test_hexagon/test_2d_physical_buffers.py @@ -331,7 +331,7 @@ def test_cache_shape(self, ir_module, input_layout, working_layout, output_layou assert len(buffer.shape) == expected_physical_dimensions def test_lower(self, schedule_args): - return tvm.lower(*schedule_args) + assert tvm.lower(*schedule_args) @requires_hexagon_toolchain def test_build(self, schedule_args, target_host, input_layout, working_layout, output_layout): diff --git a/tests/python/contrib/test_hexagon/test_maxpool2d_blocked.py b/tests/python/contrib/test_hexagon/test_maxpool2d_blocked.py index dbf3f3d790f5..0cc6dbd8163f 100644 --- a/tests/python/contrib/test_hexagon/test_maxpool2d_blocked.py +++ b/tests/python/contrib/test_hexagon/test_maxpool2d_blocked.py @@ -151,7 +151,7 @@ def test_maxpool(self, shape_nhwc, window_size, stride, pad, dtype, target): padding=(pad, pad, pad, pad), dtype=dtype, ) - return output, ref_output + assert all([output is not None, ref_output is not None]) if __name__ == "__main__":