Index: sasmodels/model_test.py
===================================================================
--- sasmodels/model_test.py	(revision 40a87fa5096610e24c3ead10299f609e99f093f2)
+++ sasmodels/model_test.py	(revision 897ca7f478f1466ca3d839c8d89b623c240a431a)
@@ -50,5 +50,6 @@
 import numpy as np  # type: ignore
 
-from .core import list_models, load_model_info, build_model, HAVE_OPENCL
+from . import core
+from .core import list_models, load_model_info, build_model
 from .direct_model import call_kernel, call_ER, call_VR
 from .exception import annotate_exception
@@ -98,5 +99,5 @@
         if is_py:  # kernel implemented in python
             test_name = "Model: %s, Kernel: python"%model_name
-            test_method_name = "test_%s_python" % model_name
+            test_method_name = "test_%s_python" % model_info.id
             test = ModelTestCase(test_name, model_info,
                                  test_method_name,
@@ -106,7 +107,7 @@
         else:   # kernel implemented in C
             # test using opencl if desired and available
-            if 'opencl' in loaders and HAVE_OPENCL:
+            if 'opencl' in loaders and core.HAVE_OPENCL:
                 test_name = "Model: %s, Kernel: OpenCL"%model_name
-                test_method_name = "test_%s_opencl" % model_name
+                test_method_name = "test_%s_opencl" % model_info.id
                 # Using dtype=None so that the models that are only
                 # correct for double precision are not tested using
@@ -122,5 +123,5 @@
             if 'dll' in loaders:
                 test_name = "Model: %s, Kernel: dll"%model_name
-                test_method_name = "test_%s_dll" % model_name
+                test_method_name = "test_%s_dll" % model_info.id
                 test = ModelTestCase(test_name, model_info,
                                      test_method_name,
@@ -249,8 +250,53 @@
     return abs(target-actual)/shift < 1.5*10**-digits
 
-def main():
-    # type: () -> int
-    """
-    Run tests given is sys.argv.
+def run_one(model):
+    # type: (str) -> None
+    """
+    Run the tests for a single model, printing the results to stdout.
+
+    *model* can by a python file, which is handy for checking user defined
+    plugin models.
+    """
+    # Note that running main() directly did not work from within the
+    # wxPython pycrust console.  Instead of the results appearing in the
+    # window they were printed to the underlying console.
+    from unittest.runner import TextTestResult, _WritelnDecorator
+
+    # Build a object to capture and print the test results
+    stream = _WritelnDecorator(sys.stdout)  # Add writeln() method to stream
+    verbosity = 2
+    descriptions = True
+    result = TextTestResult(stream, descriptions, verbosity)
+
+    # Build a test suite containing just the model
+    loaders = ['opencl']
+    models = [model]
+    try:
+        suite = make_suite(loaders, models)
+    except Exception:
+        import traceback
+        stream.writeln(traceback.format_exc())
+        return
+
+    # Run the test suite
+    suite.run(result)
+
+    # Print the failures and errors
+    for _, tb in result.errors:
+        stream.writeln(tb)
+    for _, tb in result.failures:
+        stream.writeln(tb)
+
+    # Check if there are user defined tests.
+    # Yes, it is naughty to peek into the structure of the test suite, and
+    # to assume that it contains only one test.
+    if not suite._tests[0].info.tests:
+        stream.writeln("Note: %s has no user defined tests."%model)
+
+
+def main(*models):
+    # type: (*str) -> int
+    """
+    Run tests given is models.
 
     Returns 0 if success or 1 if any tests fail.
@@ -263,5 +309,4 @@
         test_args = {}
 
-    models = sys.argv[1:]
     if models and models[0] == '-v':
         verbosity = 2
@@ -270,5 +315,5 @@
         verbosity = 1
     if models and models[0] == 'opencl':
-        if not HAVE_OPENCL:
+        if not core.HAVE_OPENCL:
             print("opencl is not available")
             return 1
@@ -318,3 +363,3 @@
 
 if __name__ == "__main__":
-    sys.exit(main())
+    sys.exit(main(*sys.argv[1:]))
