convexengineering / gpfit

Fit posynomials to data
http://gpfit.readthedocs.io/en/latest/
MIT License
10 stars 7 forks source link

run_tests returns error #94

Closed pgkirsch closed 3 years ago

pgkirsch commented 3 years ago
$ ipython run_tests.py 
---------------------------------------------------------------------------
...
...

~/Optimization/gpfit/gpfit/tests/t_examples.py in <module>
     38 EXAMPLE_DIR = os.path.abspath(FILE_DIR + '../../../docs/source/examples')
     39 # use gpkit.tests.helpers.generate_example_tests default: only default solver
---> 40 TESTS = generate_example_tests(EXAMPLE_DIR, [TestExamples])
     41 
     42 

~/Optimization/gpkit/gpkit/tests/helpers.py in generate_example_tests(path, testclasses, solvers, newtest_fn)
     34                 setattr(testclass, name, old_test)  # move to a non-test fn
     35                 delattr(testclass, fn)  # delete the old old_test
---> 36                 for solver in solvers:
     37                     new_name = "test_%s_%s" % (name, solver)
     38                     new_fn = newtest_fn(name, solver, import_dict, path)

TypeError: 'NoneType' object is not iterable

This appears to be caused by a GPkit change.

@bqpd do you remember why that change was made? Do you suggest we pass the solvers into the function or revert this GPkit change?

bqpd commented 3 years ago

Oh yes, this was added so that the skipsolvers argument could be done for research-model tests:

    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)

for GPfit you probably don't need to skip solvers, so you can use use settings["installed_solvers"] as the argument?

pgkirsch commented 3 years ago

@bqpd sorry forgot to reply but yes this solved it. Will create a PR.