def install_all_tools(): sumtime = 0.0 n_tools = 0 n_success = 0 for tool_class in tools.all_tool_classes(): t = tool_class() print("installing %s .. " % tool_class.__name__, end="") sys.stdout.flush() runtime = timeit.timeit(t.install) sumtime += runtime success = t.is_installed() print("SUCCESS" if success else "FAILED", end="") print(" (%0.1f seconds)" % runtime) sys.stdout.flush() if success: n_success += 1 n_tools += 1 print("Total %d tools attempted, %d succeeded, %d failed, cumulative install time %0.1f seconds" % ( n_tools, n_success, n_tools - n_success, sumtime)) return (n_tools == n_success)
# Unit tests for tools/__init__.py __author__ = "*****@*****.**" import tools from tools import * import pytest @pytest.fixture(params=tools.all_tool_classes()) def tool_class(request): print(request.param) return request.param def test_tool_install(tool_class): t = tool_class() t.install() assert t.is_installed()