{"id":15750258,"url":"https://github.com/objarni/pytddmon_refactored","last_synced_at":"2025-03-31T07:15:52.612Z","repository":{"id":36937389,"uuid":"41244701","full_name":"objarni/pytddmon_refactored","owner":"objarni","description":"An attempt to refactor pytddmon into a more unit-testable and extensible architecture based on Finite State Machines / message queues","archived":false,"fork":false,"pushed_at":"2015-09-06T09:20:09.000Z","size":148,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T11:55:20.215Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/objarni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-23T10:05:10.000Z","updated_at":"2015-09-06T09:20:09.000Z","dependencies_parsed_at":"2022-07-08T15:51:36.625Z","dependency_job_id":null,"html_url":"https://github.com/objarni/pytddmon_refactored","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objarni%2Fpytddmon_refactored","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objarni%2Fpytddmon_refactored/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objarni%2Fpytddmon_refactored/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objarni%2Fpytddmon_refactored/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/objarni","download_url":"https://codeload.github.com/objarni/pytddmon_refactored/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246429493,"owners_count":20775808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-04T06:23:07.942Z","updated_at":"2025-03-31T07:15:52.590Z","avatar_url":"https://github.com/objarni.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pytddmon_refactored\nAn attempt to refactor pytddmon into a more unit-testable and extensible architecture\nbased on Finite State Machines / message queues.\n\n\nProblems with current design\n============================\n\nThe current pytddmon source is basically a \"hack\"; it began without any unit tests at all,\nwritten in a night of inspiration (and perspiration).\n\nIt used pygame for the graphical user interface, and os.system() calls to run tests\nusing nosetests.\n\nTo display the result - number of passed and total count of unit tests - it parsed the\nstdout of nosetests and updated the UI.\n\nYears later it has moved from pygame to Tkinter, and uses subprocess + multiprocess\npooling to run unit test removing the need to parse the output. A lot of functionality\nhas moved to small classes that are unit tested, and it now features some command line\noptions, e.g. the ability to run in 'test mode' for integration level automatic tests\n(the systests suite).\n\nEven if the design is a whole lot better than the hack it used to be, it is still entangled\non the top-level of the \"system\"; e.g. the UI class \"knows\" a lot about the internals of the\nPytddmon class.\n\nA new design\n============\n\nA more loosely coupled design would be to base as many components as possible of pytddmon on\n_finite state machines_, running (logically) independent of each other, and just publishing\nand/or listening to events happening in the system.\n\nThe function of pytddmon lends itself to be described by such devices quite naturally:\n\n1. The TestRunner would be a state machine that is responsible for running tests.\n\n2. The ChangeDetector would be a state machine that is responsible for detecting file changes.\n\n3. The Lamp would be a state machine responsible for updating the UI depending on test results (and possibly tests being run too, a feature not present in current pytddmon.)\n      \nWith this architecture, the whole of pytddmon would be setting up these machines, choosing\nan appropriate UI object (Tk/Gtk/Console), and then making the whole thing 'tick' by\npublishing events.\n\n\nOpen questions\n==============\n\n1. How does the ChangeDetector detect file changes...? What makes it scan for file changes? In\ntraditional pytddmon, this was a timeout triggering a scan every half a second. The\nequivalent in this redesign would be a thread publishing a 'heartbeat' event with same\ninterval, or a mechanism that is intrinsic to the choice of GUI tech (preferably not).\n\n2. Given this more general architecture, would a notification mechanism/object based on operating system events/notifications be more viable? What about Windows?\n\n3. How do devices publish events? For testability, the publish method should be easily\nmockable.\n\n4. What's an event? Is it a better name than signal or message?\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjarni%2Fpytddmon_refactored","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobjarni%2Fpytddmon_refactored","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjarni%2Fpytddmon_refactored/lists"}