Changeset 35a408b7 for tests/pybin


Ignore:
Timestamp:
Jun 26, 2019, 1:51:28 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
b0ab7853, e507c11
Parents:
05c34c3
Message:

Fixed global timeout

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/pybin/tools.py

    r05c34c3 r35a408b7  
    179179                        os.chdir(cwd)
    180180
     181def killgroup():
     182        try:
     183                os.killpg(os.getpgrp(), signal.SIGINT)
     184        except KeyboardInterrupt:
     185                pass # expected
     186        except Exception as exc:
     187                print("Unexpected exception", file=sys.stderr)
     188                print(exc, file=sys.stderr)
     189                sys.stderr.flush()
     190                sys.exit(2)
     191
    181192################################################################################
    182193#               file handling
     
    301312        self.end = time.time()
    302313        self.duration = self.end - self.start
     314
     315def timed(src, timeout):
     316        expire = time.time() + timeout
     317        i = iter(src)
     318        while True:
     319                yield i.next(max(expire - time.time(), 0))
Note: See TracChangeset for help on using the changeset viewer.