diff options
author | Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net> | 2018-10-20 18:12:12 +0200 |
---|---|---|
committer | Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net> | 2018-10-20 18:12:12 +0200 |
commit | 308326c458b5089fe8e26e2547a10e86e3db04e1 (patch) | |
tree | 1b24762315ef79fd9000d24e5226030346bcbc07 /dofile-in-python | |
parent | 0703144d9083cc23a38fe6e49e532f0bdddef22b (diff) |
+ test handling of dofiles written in Python 3.5
Diffstat (limited to 'dofile-in-python')
-rw-r--r-- | dofile-in-python/all.do | 24 | ||||
-rw-r--r-- | dofile-in-python/target.do | 6 |
2 files changed, 30 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) diff --git a/dofile-in-python/target.do b/dofile-in-python/target.do new file mode 100644 index 0000000..5f0fadb --- /dev/null +++ b/dofile-in-python/target.do @@ -0,0 +1,6 @@ +#!/usr/bin/env python3.5 +from subprocess import run +from datetime import datetime + +run(['redo-ifchange', 'source']) +print(datetime.now().timestamp()) |