Index: tests/peter/test_gen_requirements.py =================================================================== diff -u -r1508298c28026c5a1df24fb8e614cb8ab65b2e09 -rca7a00d1584b97eed9471fe4a5f17a7aa3ea62d8 --- tests/peter/test_gen_requirements.py (.../test_gen_requirements.py) (revision 1508298c28026c5a1df24fb8e614cb8ab65b2e09) +++ tests/peter/test_gen_requirements.py (.../test_gen_requirements.py) (revision ca7a00d1584b97eed9471fe4a5f17a7aa3ea62d8) @@ -17,25 +17,15 @@ sys.path.append("../../") from dialin.dg.dialysate_generator import DG from dialin.hd.hemodialysis_device import HD -from dialin.hd.constants import RESET, NO_RESET, BUTTON_PRESSED, BUTTON_RELEASED -import time -import pprint +from typing import List -def test_dg_version(): +def gen_publish_requirements(modules: List[object]) -> dict: """ - Prints the DG version. - - @return: None + Generates a list of publish requirements + @param modules: + @return: """ - dg = DG() - if dg.cmd_log_in_to_dg(): - dg.cmd_ui_request_dg_version() - time.sleep(0.5) - print(dg.dg_version) - - -def gen_publish_requirements(modules): result = {} for module in modules: @@ -49,28 +39,28 @@ not attr.isupper(): result[module.__class__.__name__] = result.get(module.__class__.__name__, []) + [attr] - # pp = pprint.PrettyPrinter(indent=4) - # pp.pprint(result) - for module, attrs in result.items(): print("\n{0} \n ".format(module)) for attr in attrs: print("The Dialin API shall publish the {0} to all observers upon HD messaging.".format(attr.replace("_", " "))) return result -def gen_cmd_requirements(modules): +def gen_cmd_requirements(modules: List[object]) -> dict: + """ + Generates requirements from dialin commands + @param modules: the list of modules to generate requirements for + @return: + """ + result = {} for module in modules: for attr in dir(module): if callable(getattr(module, attr)) and attr.startswith("cmd"): result[module.__class__.__name__] = result.get(module.__class__.__name__, []) + [attr] - # pp = pprint.PrettyPrinter(indent=4) - # pp.pprint(result) - for module, attrs in result.items(): print("\n{0} \n ".format(module)) for attr in attrs: @@ -121,17 +111,6 @@ dg = DG() modules = [ - # hd.hd_proxy, - # hd.load_cells, - # hd.pressures, - # hd.reservoirs, - # hd.valves, - # hd.ro_pump, - # hd.drain_pump, - # hd.heaters, - # hd.temperature_sensors, - # hd.conductivity_sensors, - # hd.accel, dg.alarms, dg.concentrate_pumps, dg.fans, @@ -146,4 +125,4 @@ if __name__ == '__main__': generate_dg_requirements() - # generate_hd_requirements() + generate_hd_requirements()