Skip to content

Commit 074a459

Browse files
committed
[tests] WIP Plugins
1 parent 0c5e769 commit 074a459

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

tests/test_plugins.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from meshroom.core.plugins import NodePluginStatus, Plugin
55

66
import os
7+
import time
78

89
class TestPluginWithValidNodesOnly:
910
plugin = None
@@ -173,10 +174,14 @@ def test_reloadNodePlugin(self):
173174
originalFileContent = None
174175
with open(node.path, "r") as f:
175176
originalFileContent = f.read()
177+
178+
timestampOr = os.path.getmtime(node.path)
176179

177180
replaceFileContent = originalFileContent.replace('"not an integer"', '1')
178181
with open(node.path, "w") as f:
179182
f.write(replaceFileContent)
183+
184+
timestampRep = os.path.getmtime(node.path)
180185

181186
# Reload the node and assert it is valid
182187
node.reload()
@@ -185,10 +190,27 @@ def test_reloadNodePlugin(self):
185190
# Attempt to register node plugin
186191
pluginManager.registerNode(node)
187192
assert pluginManager.isRegistered(nodeName)
193+
194+
# Reload the node again without any change
195+
node.reload()
196+
assert pluginManager.isRegistered(nodeName)
188197

189198
# Restore the node file to its original state (with a description error)
199+
print(replaceFileContent)
200+
print("===============")
201+
print(originalFileContent)
202+
print("\n\n\n")
203+
print(f"Timestamp original: {timestampOr}")
204+
print(f"Timestamp replaced: {timestampRep}")
205+
206+
time.sleep(0.1)
207+
190208
with open(node.path, "w") as f:
191209
f.write(originalFileContent)
210+
211+
timestampOr2 = os.path.getmtime(node.path)
212+
print(f"New timestamp: {timestampOr2}")
213+
print(os.stat(node.path))
192214

193215
# Reload the node and assert it is invalid while still registered
194216
node.reload()

0 commit comments

Comments
 (0)