summaryrefslogtreecommitdiff
path: root/dofile-in-python/all.do
diff options
context:
space:
mode:
Diffstat (limited to 'dofile-in-python/all.do')
-rw-r--r--dofile-in-python/all.do24
1 files changed, 24 insertions, 0 deletions
diff --git a/dofile-in-python/all.do b/dofile-in-python/all.do
new file mode 100644
index 0000000..f236774
--- /dev/null
+++ b/dofile-in-python/all.do
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3.5
+from subprocess import run
+from time import sleep
+
+with open('source', 'w') as f:
+ f.write('foo')
+
+run(['redo-ifchange', 'target'])
+
+with open('target', 'r') as f:
+ target_contents_1 = f.read()
+
+sleep(1)
+
+with open('source', 'w') as f:
+ f.write('bar')
+
+run(['redo-ifchange', 'target'])
+
+with open('target', 'r') as f:
+ target_contents_2 = f.read()
+
+if target_contents_1 == target_contents_2:
+ exit(1)