def end(): stack = inspect.stack() frames = [frame_obj[0] for frame_obj in stack] last_frame = frames[1] base_locals = last_frame.f_locals test_funcs = clean(base_locals) i = test_funcs.values()[0] if i.__hash__() not in hash_registry: hash_registry.append(i.__hash__()) #i() func = i name = i.__name__ if len(call_stack) > 0: current_root = map_call_stack(spec_list) else: current_root = root_spec() call_stack.append(name) index = call_stack.index(name) current_tree = last_tree(current_root) current_spec = last_spec(current_root) if current_spec: if "description" in current_spec and "name" not in current_spec: current_spec["name"] = name elif current_spec: current_tree.append({"name": name}) else: current_tree.append({"name": name}) if name not in ["spec"]: if not current_spec: current_tree[-1]["tree"] = [] else: new_spec = get_item(current_tree, "name", name) new_spec["tree"] = [] func() else: new_spec = get_item(current_tree, "name", name) new_spec["func"] = func del call_stack[index] if call_stack == []: print("") print_tree_condensed() print("") run_tests(spec_list)
#!/usr/bin/env python import sys import test_runner if __name__ == '__main__': tests = [] if len(sys.argv) > 1: selected_tests = sys.argv[1:] for tc in selected_tests: loaded_tests = test_runner.load_tests(tc) if loaded_tests: tests += loaded_tests test_runner.run_tests(tests)
""" Copyright 2012-2019 Ministerie van Sociale Zaken en Werkgelegenheid Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from test_runner import run_tests if __name__ == '__main__': # pragma: no branch run_tests("unittests", "unit-test-reports")
import sys from assertions import assert_equals from rock_paper_scissors import WINNER_HAND_1, WINNER_HAND_2, DRAW, SCISSORS, PAPER, ROCK, rock_paper_scissors from test_runner import run_tests def test_rock_blunts_scissors(): assert_equals(WINNER_HAND_1, rock_paper_scissors(ROCK, SCISSORS)) def test_scissors_blunted_by_rock(): assert_equals(WINNER_HAND_2, rock_paper_scissors(SCISSORS, ROCK)) def test_paper_wraps_rock(): assert_equals(WINNER_HAND_1, rock_paper_scissors(PAPER, ROCK)) def test_rock_is_wrapped_by_paper(): assert_equals(WINNER_HAND_2, rock_paper_scissors(ROCK, PAPER)) def test_rock_draws_with_rock(): assert_equals(DRAW, rock_paper_scissors(ROCK, ROCK)) if __name__ == '__main__': run_tests(sys.modules[__name__])
def run_integration_tests() -> None: """ Create the application bundle and run the integration tests. """ my_dir = pathlib.Path(__file__).resolve().parent setup_py = my_dir.parent / "setup.py" os.system(f"{sys.executable} {setup_py} bundle") run_tests("integrationtests", "integration-test-reports")
assert hero.strength == 0, 'Vampire fight does not decrease Hero strength' assert not hero.is_alive, 'Vampire fight does not kill Hero' assert hero.kills == 1, 'Vampire fight breaks existing Hero kill count' assert second_vampire.is_alive, 'Vampire fight breaks Vampire is_alive' assert second_vampire.strength == 85, 'Vampire fight does not increase strength after win' assert second_vampire.kills == 1, 'Vampire fight deos not increase Vampire kills' def test_hero_loses_against_zombie(): hero = Hero() zombie = Zombie() assert zombie.strength == 150, 'Zombie strength does not initialize properly' zombie.fight(hero) assert not hero.is_alive, 'Zombie fight does not kill Hero' assert hero.kills == 0, 'Zombie fight breaks Hero kills' assert zombie.is_alive, 'Zombie fight breaks Zombie is_alive' assert zombie.kills == 1, 'Zombie fight breaks Zombie kills' assert zombie.strength > 50, 'Zombie fight does not increase strength' assert zombie.strength < 61, 'Zombie fight increases strength too much' if __name__ == '__main__': from test_runner import run_tests run_tests() Contact GitHub API Training Shop Blog About © 2017 GitHub, Inc. Terms Privacy Security Status Help
""" Copyright 2012-2019 Ministerie van Sociale Zaken en Werkgelegenheid Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from test_runner import run_tests if __name__ == '__main__': # pragma: no branch run_tests("qualitytests", "quality-test-reports")