From 9089cc44849b8222459598f6ce9826fe18ba0f98 Mon Sep 17 00:00:00 2001 From: Stephan Seitz <stephan.seitz@fau.de> Date: Mon, 19 Aug 2019 12:51:29 +0200 Subject: [PATCH] Remove main methods from tests ... or code will be executed when pytest is collecting the tests. I found out that I can use "-s" to convince vim-test to show me test output. --- pystencils_tests/test_address_of.py | 1 - .../test_assignment_collection_dict_conversion.py | 8 -------- pystencils_tests/test_cuda_known_functions.py | 10 ---------- pystencils_tests/test_custom_backends.py | 8 -------- pystencils_tests/test_destructuring_field_class.py | 9 --------- pystencils_tests/test_floor_ceil_int_optimization.py | 9 --------- pystencils_tests/test_global_definitions.py | 9 --------- .../test_match_subs_for_assignment_collection.py | 10 ---------- pystencils_tests/test_print_unsupported_node.py | 8 -------- 9 files changed, 72 deletions(-) diff --git a/pystencils_tests/test_address_of.py b/pystencils_tests/test_address_of.py index c31091cee..9aac08d10 100644 --- a/pystencils_tests/test_address_of.py +++ b/pystencils_tests/test_address_of.py @@ -31,7 +31,6 @@ def test_address_of(): def test_address_of_with_cse(): x, y = pystencils.fields('x,y: int64[2d]') - s = pystencils.TypedSymbol('s', PointerType('int64')) assignments = pystencils.AssignmentCollection({ y[0, 0]: cast_func(address_of(x[0, 0]), 'int64'), diff --git a/pystencils_tests/test_assignment_collection_dict_conversion.py b/pystencils_tests/test_assignment_collection_dict_conversion.py index 651e0a212..16d38de82 100644 --- a/pystencils_tests/test_assignment_collection_dict_conversion.py +++ b/pystencils_tests/test_assignment_collection_dict_conversion.py @@ -30,11 +30,3 @@ def test_assignment_collection_dict_conversion(): assert collection_dict.main_assignments_dict == {y[1, 0]: x.center(), y[0, 0]: x.center()} assert collection_dict.subexpressions_dict == {} - - -def main(): - test_assignment_collection_dict_conversion() - - -if __name__ == '__main__': - main() diff --git a/pystencils_tests/test_cuda_known_functions.py b/pystencils_tests/test_cuda_known_functions.py index 5742a3262..cd0304f8f 100644 --- a/pystencils_tests/test_cuda_known_functions.py +++ b/pystencils_tests/test_cuda_known_functions.py @@ -47,13 +47,3 @@ def test_cuda_unknown(): code = str(pystencils.show_code(ast)) print(code) assert "Not supported in CUDA" in code - - -def main(): - test_cuda_known_functions() - test_cuda_but_not_c() - test_cuda_unknown() - - -if __name__ == '__main__': - main() diff --git a/pystencils_tests/test_custom_backends.py b/pystencils_tests/test_custom_backends.py index 0a018683a..1ff775d41 100644 --- a/pystencils_tests/test_custom_backends.py +++ b/pystencils_tests/test_custom_backends.py @@ -40,11 +40,3 @@ def test_custom_backends(): print(pystencils.show_code(ast, ScreamingGpuBackend())) with pytest.raises(pycuda.driver.CompileError): pystencils.gpucuda.cudajit.make_python_function(ast, custom_backend=ScreamingGpuBackend()) - - -def main(): - test_custom_backends() - - -if __name__ == "__main__": - main() diff --git a/pystencils_tests/test_destructuring_field_class.py b/pystencils_tests/test_destructuring_field_class.py index fb15068cd..4b9faf632 100644 --- a/pystencils_tests/test_destructuring_field_class.py +++ b/pystencils_tests/test_destructuring_field_class.py @@ -41,12 +41,3 @@ def test_destructuring_alternative_field_class(): ast = pystencils.create_kernel(normal_assignments, target='gpu') ast.body = DestructuringEmojiClass(ast.body) print(pystencils.show_code(ast)) - - -def main(): - test_destructuring_field_class() - test_destructuring_alternative_field_class() - - -if __name__ == '__main__': - main() diff --git a/pystencils_tests/test_floor_ceil_int_optimization.py b/pystencils_tests/test_floor_ceil_int_optimization.py index 2d6efba7b..7ec81b05b 100644 --- a/pystencils_tests/test_floor_ceil_int_optimization.py +++ b/pystencils_tests/test_floor_ceil_int_optimization.py @@ -64,12 +64,3 @@ def test_floor_ceil_float_no_optimization(): assert sp.floor(a).match(wild_floor) assert assignments.find(wild_floor) - - -def main(): - test_floor_ceil_int_optimization() - test_floor_ceil_float_no_optimization() - - -if __name__ == '__main__': - main() diff --git a/pystencils_tests/test_global_definitions.py b/pystencils_tests/test_global_definitions.py index 01c044427..52def8c6b 100644 --- a/pystencils_tests/test_global_definitions.py +++ b/pystencils_tests/test_global_definitions.py @@ -125,12 +125,3 @@ def test_global_definitions_without_global_symbol(): assert kernel is not None assert TypedSymbol('Foo', 'double') in [p.symbol for p in ast.get_parameters()] - - -def main(): - test_global_definitions_with_global_symbol() - test_global_definitions_without_global_symbol() - - -if __name__ == '__main__': - main() diff --git a/pystencils_tests/test_match_subs_for_assignment_collection.py b/pystencils_tests/test_match_subs_for_assignment_collection.py index 81dec872d..9bcc5ad6b 100644 --- a/pystencils_tests/test_match_subs_for_assignment_collection.py +++ b/pystencils_tests/test_match_subs_for_assignment_collection.py @@ -87,13 +87,3 @@ def test_match_for_assignment_collection(): } assert assignments.find(wild_ceiling) == {sp.ceiling(x.center())} assert len([a for a in assignments.find(wild_addition) if isinstance(a, sp.Add)]) == 2 - - -def main(): - test_wild_typed_symbol() - test_replace_and_subs_for_assignment_collection() - test_match_for_assignment_collection() - - -if __name__ == '__main__': - main() diff --git a/pystencils_tests/test_print_unsupported_node.py b/pystencils_tests/test_print_unsupported_node.py index 16cf6739c..674a7b390 100644 --- a/pystencils_tests/test_print_unsupported_node.py +++ b/pystencils_tests/test_print_unsupported_node.py @@ -22,11 +22,3 @@ class UnsupportedNode(pystencils.astnodes.Node): def test_print_unsupported_node(): with pytest.raises(NotImplementedError, match='CBackend does not support node of type UnsupportedNode'): CBackend()(UnsupportedNode()) - - -def main(): - test_print_unsupported_node() - - -if __name__ == '__main__': - main() -- GitLab