Explorer
/proc/15/root/tmp/fix_fail.py
← Zurück ↓ Download
#!/usr/bin/env python3
"""Fix failure test: create the note file first (failure was FileNotFoundError,
not the simulated timeout), and use a unique path."""
p = '/tmp/p2w_test.py'
src = open(p).read()
old = '''    'aa043:obsidian-general:p2wfail',?, ?, '__source__','UPDATE_VERSION')""", (vid, "e"*64))'''
new = '''    'aa043:obsidian-general:p2wfail',?, ?, '__source__','UPDATE_VERSION')""", (vid, "e"*64))
import os as _os2
_os2.makedirs('/tmp/P2W2', exist_ok=True)
with open('/tmp/P2W2/fail.md', 'w') as _f:
    _f.write('# fail test')'''
assert old in src
src = src.replace(old, new)
# point obsidian_path at the created file
old2 = "'P2W/fail.md'"
assert old2 in src
src = src.replace(old2, "'/tmp/P2W2/fail.md'")
open(p, 'w').write(src)
print('fail test fixed: file exists, timeout simulated via guarded urlopen')