Ignore:
Timestamp:
Jul 30, 2018 8:22:14 AM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
Children:
fa374b0
Parents:
c1790a5
Message:

fix broken plugin model tests. Fixes #1142

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/calculator/pyconsole.py

    r4627657 r2a6058c  
    2828    Check that the model on the path can run. 
    2929    """ 
     30    # TODO: fix model caching 
     31    # model_test.run_one() is directly forcing a reload of the module, but 
     32    # sasview_model is caching models that have already been loaded. 
     33    # If the sasview load happens before the test, then the module is 
     34    # reloaded out from under it, which causes the global variables in 
     35    # the model function definitions to be cleared (at least in python 2.7). 
     36    # To fix the proximal problem of models failing on test, perform the 
     37    # run_one() tests first.  To fix the deeper problem we should either 
     38    # remove caching from sasmodels.sasview_model.load_custom_model() or 
     39    # add caching to sasmodels.custom.load_custom_kernel_module(). 
     40 
     41    # check the model's unit tests run 
     42    from sasmodels.model_test import run_one 
     43    result = run_one(path) 
     44 
    3045    # try running the model 
    3146    from sasmodels.sasview_model import load_custom_model 
     
    3651    qx, qy =  np.array([0.01, 0.01]), np.array([0.1, 0.1]) 
    3752    Iqxy = model.evalDistribution([qx, qy]) 
    38  
    39     # check the model's unit tests run 
    40     from sasmodels.model_test import run_one 
    41     result = run_one(path) 
    4253 
    4354    return result 
Note: See TracChangeset for help on using the changeset viewer.