Пример #1
0
def run(filename="TESTS", xmloutput=False, skipsolvers=None):
    "Parse and run paths from a given file for each solver"
    with open(filename, "r") as f:
        for path in f:
            add_filetest(TestFiles, path)
    solvers = [s for s in settings["installed_solvers"] if not skipsolvers or s not in skipsolvers]
    tests = generate_example_tests("", [TestFiles], solvers, newtest_fn=newtest_fn)
    if not solvers:
        # Dummy test in case all installed solvers are skipped.
        tests[0].test_dummy = lambda self: None
    from gpkit.tests.run_tests import run as run_

    run_(tests=tests, unitless=False, xmloutput=xmloutput)
Пример #2
0
def run(filename="TESTS", xmloutput=False, skipsolvers=None):
    "Parse and run paths from a given file for each solver"
    with open(filename, "r") as f:
        for path in f:
            add_filetest(TestFiles, path)
    solvers = [s for s in settings["installed_solvers"]
               if not skipsolvers or s not in skipsolvers]
    tests = generate_example_tests("", [TestFiles], solvers,
                                   newtest_fn=newtest_fn)
    if not solvers:
        # Dummy test in case all installed solvers are skipped.
        tests[0].test_dummy = lambda self: None
    from gpkit.tests.run_tests import run as run_
    run_(tests=tests, unitless=False, xmloutput=xmloutput)
Пример #3
0
                "N_{ult}": 0.2903,
                "W_0": 1.0107,
                r"\rho": -0.2275
            }
            for key in freevarcheck:
                sol_rat = mag(sol["variables"][key])/freevarcheck[key]
                self.assertTrue(abs(1-sol_rat) < 1e-2)
            for key in senscheck:
                sol_rat = sol["sensitivities"]["variables"][key]/senscheck[key]
                self.assertTrue(abs(1-sol_rat) < 1e-2)

    def test_relaxation(self, example):
        pass

    def test_unbounded(self, example):
        pass


FILE_DIR = os.path.dirname(os.path.realpath(__file__))
EXAMPLE_DIR = os.path.abspath(FILE_DIR + '../../../docs/source/examples')
SOLVERS = settings["installed_solvers"]
if os.path.isdir(EXAMPLE_DIR):
    TESTS = generate_example_tests(EXAMPLE_DIR, [TestExamples], SOLVERS)
else:
    TESTS = []

if __name__ == "__main__":
    # pylint:disable=wrong-import-position
    from gpkit.tests.helpers import run_tests
    run_tests(TESTS)
Пример #4
0
                "N_{ult}": 0.2903,
                "W_0": 1.0107,
                r"\rho": -0.2275
            }
            for key in freevarcheck:
                sol_rat = mag(sol["variables"][key])/freevarcheck[key]
                self.assertTrue(abs(1-sol_rat) < 1e-2)
            for key in senscheck:
                sol_rat = sol["sensitivities"]["constants"][key]/senscheck[key]
                self.assertTrue(abs(1-sol_rat) < 1e-2)

    def test_relaxation(self, example):
        pass

    def test_unbounded(self, example):
        pass


FILE_DIR = os.path.dirname(os.path.realpath(__file__))
EXAMPLE_DIR = os.path.abspath(FILE_DIR + '../../../docs/source/examples')
SOLVERS = settings["installed_solvers"]
if os.path.isdir(EXAMPLE_DIR):
    TESTS = generate_example_tests(EXAMPLE_DIR, [TestExamples], SOLVERS)
else:
    TESTS = []

if __name__ == "__main__":
    # pylint:disable=wrong-import-position
    from gpkit.tests.helpers import run_tests
    run_tests(TESTS)