summaryrefslogtreecommitdiff
path: root/pyvisa-py/testsuite/__init__.py
blob: 6157c8861b2d67b666aeea71ad277aefe0fc5fa6 (plain)
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
# -*- coding: utf-8 -*-

from __future__ import division, unicode_literals, print_function, absolute_import

import os

from pyvisa.compat import unittest


def testsuite():
    """A testsuite that has all the pyvisa tests.
    """
    return unittest.TestLoader().discover(os.path.dirname(__file__))


def main():
    """Runs the testsuite as command line application.
    """
    try:
        unittest.main()
    except Exception as e:
        print('Error: %s' % e)


def run():
    """Run all tests.

    :return: a :class:`unittest.TestResult` object
    """
    test_runner = unittest.TextTestRunner()
    return test_runner.run(testsuite())