File: comparative_benchmarks.py

package info (click to toggle)
python-qwt 0.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,980 kB
  • sloc: python: 11,763; makefile: 16
file content (43 lines) | stat: -rw-r--r-- 1,059 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding: utf-8 -*-
#
# Licensed under the terms of the MIT License
# Copyright (c) 2015 Pierre Raybaut
# (see LICENSE file for more details)

"""
PyQwt5 vs. PythonQwt
====================
"""

import os
import os.path as osp
import sys
import subprocess
import time


def run_script(filename, args=None, wait=True):
    """Run Python script"""
    os.environ['PYTHONPATH'] = os.pathsep.join(sys.path)
    
    command = [sys.executable, '"'+filename+'"']
    if args is not None:
        command.append(args)
    proc = subprocess.Popen(" ".join(command), shell=True)
    if wait:
        proc.wait()


def main():
    for name in ('CurveBenchmark.py', 'CurveStyles.py',):
        for args in (None, 'only_lines'):
            for value in ('', '1'):
                os.environ['USE_PYQWT5'] = value
                filename = osp.join(osp.dirname(osp.abspath(__file__)), name)
                run_script(filename, wait=False, args=args)
                time.sleep(4)


if __name__ == '__main__':
    main()