Skip to content
Snippets Groups Projects
Commit 9089cc44 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

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.
parent 790a98fc
Branches
Tags
No related merge requests found
...@@ -31,7 +31,6 @@ def test_address_of(): ...@@ -31,7 +31,6 @@ def test_address_of():
def test_address_of_with_cse(): def test_address_of_with_cse():
x, y = pystencils.fields('x,y: int64[2d]') x, y = pystencils.fields('x,y: int64[2d]')
s = pystencils.TypedSymbol('s', PointerType('int64'))
assignments = pystencils.AssignmentCollection({ assignments = pystencils.AssignmentCollection({
y[0, 0]: cast_func(address_of(x[0, 0]), 'int64'), y[0, 0]: cast_func(address_of(x[0, 0]), 'int64'),
......
...@@ -30,11 +30,3 @@ def test_assignment_collection_dict_conversion(): ...@@ -30,11 +30,3 @@ def test_assignment_collection_dict_conversion():
assert collection_dict.main_assignments_dict == {y[1, 0]: x.center(), assert collection_dict.main_assignments_dict == {y[1, 0]: x.center(),
y[0, 0]: x.center()} y[0, 0]: x.center()}
assert collection_dict.subexpressions_dict == {} assert collection_dict.subexpressions_dict == {}
def main():
test_assignment_collection_dict_conversion()
if __name__ == '__main__':
main()
...@@ -47,13 +47,3 @@ def test_cuda_unknown(): ...@@ -47,13 +47,3 @@ def test_cuda_unknown():
code = str(pystencils.show_code(ast)) code = str(pystencils.show_code(ast))
print(code) print(code)
assert "Not supported in CUDA" in 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()
...@@ -40,11 +40,3 @@ def test_custom_backends(): ...@@ -40,11 +40,3 @@ def test_custom_backends():
print(pystencils.show_code(ast, ScreamingGpuBackend())) print(pystencils.show_code(ast, ScreamingGpuBackend()))
with pytest.raises(pycuda.driver.CompileError): with pytest.raises(pycuda.driver.CompileError):
pystencils.gpucuda.cudajit.make_python_function(ast, custom_backend=ScreamingGpuBackend()) pystencils.gpucuda.cudajit.make_python_function(ast, custom_backend=ScreamingGpuBackend())
def main():
test_custom_backends()
if __name__ == "__main__":
main()
...@@ -41,12 +41,3 @@ def test_destructuring_alternative_field_class(): ...@@ -41,12 +41,3 @@ def test_destructuring_alternative_field_class():
ast = pystencils.create_kernel(normal_assignments, target='gpu') ast = pystencils.create_kernel(normal_assignments, target='gpu')
ast.body = DestructuringEmojiClass(ast.body) ast.body = DestructuringEmojiClass(ast.body)
print(pystencils.show_code(ast)) print(pystencils.show_code(ast))
def main():
test_destructuring_field_class()
test_destructuring_alternative_field_class()
if __name__ == '__main__':
main()
...@@ -64,12 +64,3 @@ def test_floor_ceil_float_no_optimization(): ...@@ -64,12 +64,3 @@ def test_floor_ceil_float_no_optimization():
assert sp.floor(a).match(wild_floor) assert sp.floor(a).match(wild_floor)
assert assignments.find(wild_floor) assert assignments.find(wild_floor)
def main():
test_floor_ceil_int_optimization()
test_floor_ceil_float_no_optimization()
if __name__ == '__main__':
main()
...@@ -125,12 +125,3 @@ def test_global_definitions_without_global_symbol(): ...@@ -125,12 +125,3 @@ def test_global_definitions_without_global_symbol():
assert kernel is not None assert kernel is not None
assert TypedSymbol('Foo', 'double') in [p.symbol for p in ast.get_parameters()] 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()
...@@ -87,13 +87,3 @@ def test_match_for_assignment_collection(): ...@@ -87,13 +87,3 @@ def test_match_for_assignment_collection():
} }
assert assignments.find(wild_ceiling) == {sp.ceiling(x.center())} 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 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()
...@@ -22,11 +22,3 @@ class UnsupportedNode(pystencils.astnodes.Node): ...@@ -22,11 +22,3 @@ class UnsupportedNode(pystencils.astnodes.Node):
def test_print_unsupported_node(): def test_print_unsupported_node():
with pytest.raises(NotImplementedError, match='CBackend does not support node of type UnsupportedNode'): with pytest.raises(NotImplementedError, match='CBackend does not support node of type UnsupportedNode'):
CBackend()(UnsupportedNode()) CBackend()(UnsupportedNode())
def main():
test_print_unsupported_node()
if __name__ == '__main__':
main()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment