File: slow_process_for_testing.py

package info (click to toggle)
python-ruffus 2.8.4-8
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 16,492 kB
  • sloc: python: 17,613; makefile: 213; sh: 18
file content (24 lines) | stat: -rw-r--r-- 674 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python
from __future__ import print_function
import sys
import os
import time
print("    ", os.getcwd(), file=sys.stderr)
print("    ", os.environ, file=sys.stderr)
loop_variable = 0
loop_limit = 4
while True:
    if loop_variable >= loop_limit:
        break
    try:
        sys.stderr.write("    Stderr %d\n" % loop_variable)
        sys.stderr.flush()
        sys.stdout.write("    Stdout %d\n" % loop_variable)
        sys.stdout.flush()
        loop_variable += 1
        time.sleep(0.5)
    except:
        sys.stderr.write(
            "    Ignore Exception. Now you have made me angry: I won't stop till 100\n")
        loop_limit = 100
        pass