File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -138,3 +138,32 @@ def unload(self):
138138 # code holds references to sys.meta_path, and to preserve order, since order
139139 # is relevant.
140140 sys .meta_path [:] = self .meta_whitelist
141+
142+ if __name__ == "__main__" :
143+
144+ from pathlib import Path
145+ import time
146+
147+ dict1 = {'t' : 5 , 'val' : 10 }
148+ dict2 = {'t' : 5 , 'val' : 11 }
149+
150+ print ('ModuleWatcher instatiated in debug mode' )
151+ module_watcher = ModuleWatcher (debug = True )
152+
153+ # import a local module
154+ import labscript_utils .dict_diff
155+ print ('imported labscript_utils.dict_diff' )
156+ print (labscript_utils .dict_diff .dict_diff (dict1 , dict2 ))
157+ print ('used dict_diff function, waiting 2 seconds for module watcher to update' )
158+ time .sleep (2 )
159+
160+ # now pretend it has been updated
161+ ex_mod = Path ('dict_diff.py' )
162+ ex_mod .touch ()
163+ print ('dict_diff module touched, waiting 2 seconds for ModuleWatcher to notice' )
164+ time .sleep (2 )
165+
166+ print (labscript_utils .dict_diff .dict_diff (dict1 , dict2 ))
167+ print ('Used dict_diff again, waiting 2 seconds for ModuleWatcher to not do anything' )
168+ time .sleep (2 )
169+
You can’t perform that action at this time.
0 commit comments