File: run_tests.py

package info (click to toggle)
python-pulp 2.6.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,720 kB
  • sloc: python: 7,505; makefile: 16; sh: 16
file content (30 lines) | stat: -rw-r--r-- 875 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
import unittest
import pulp
from pulp.tests import test_pulp, test_examples


def pulpTestAll(test_docs=False):
    runner = unittest.TextTestRunner()
    suite_all = get_test_suite(test_docs)
    # we run all tests at the same time
    ret = runner.run(suite_all)
    if not ret.wasSuccessful():
        raise pulp.PulpError("Tests Failed")


def get_test_suite(test_docs=False):
    # Tests
    loader = unittest.TestLoader()
    suite_all = unittest.TestSuite()
    # we get suite with all PuLP tests
    pulp_solver_tests = loader.loadTestsFromModule(test_pulp)
    suite_all.addTests(pulp_solver_tests)
    # We add examples and docs tests
    if test_docs:
        docs_examples = loader.loadTestsFromTestCase(test_examples.Examples_DocsTests)
        suite_all.addTests(docs_examples)
    return suite_all


if __name__ == "__main__":
    pulpTestAll(test_docs=False)