File: inotify-runner-watch-dir.test

package info (click to toggle)
atheist 0.20110402-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,348 kB
  • sloc: python: 4,764; xml: 626; makefile: 113; cpp: 54; ansic: 5; sh: 5
file content (22 lines) | stat: -rw-r--r-- 676 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# -*- mode:python; coding:utf-8 -*-

import os
import signal

token =  os.path.join('$tmp','token')
test =  './test/hello.test'

watch = Test('$atheist --watch-file $tmp %s' % test, save_stderr=True,
             detach=True, timeout=0, signal=signal.SIGINT)

for i in range(1,3):
    mod = Test('echo -e " " >> %s; sync' % token, delay=0.5, shell=True)
    if i == 1:
        mod.gen += token
        mod.pre += Poll(TaskRunning(watch))
        mod.post += Poll(FileContains("[ OK ] TaskCase: %s" % test, watch.stderr,
                                      times=i),
                         timeout=10)

killer = TaskTerminator(watch)
killer.pre += Poll(TaskRunning(watch))