Index: src/sas/sascalc/calculator/instrument.py
===================================================================
--- src/sas/sascalc/calculator/instrument.py	(revision f4775563fe889a4e12295a145627987e7a33ab93)
+++ src/sas/sascalc/calculator/instrument.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -128,5 +128,9 @@
             self.size = 0
         else:
-            self.size = size
+            # TODO: Make sure detector size is number of pixels
+            # Could be detector dimensions in e.g., mm, but
+            # the resolution calculator assumes it is pixels.
+            # Being pixels, it has to be integers rather than float
+            self.size = [int(s) for s in size]
             validate(size[0])
 
Index: src/sas/sascalc/calculator/resolution_calculator.py
===================================================================
--- src/sas/sascalc/calculator/resolution_calculator.py	(revision 574adc767a9e86744546f8edd6a23dc4f81914ad)
+++ src/sas/sascalc/calculator/resolution_calculator.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -1007,6 +1007,6 @@
         try:
             detector_offset = self.sample2detector_distance[1]
-        except:
-            logger.error(sys.exc_value)
+        except Exception as exc:
+            logger.error(exc)
 
         # detector size in [no of pix_x,no of pix_y]
@@ -1094,6 +1094,6 @@
             output.qx_data = qx_value
             output.qy_data = qy_value
-        except:
-            logger.error(sys.exc_value)
+        except Exception as exc:
+            logger.error(exc)
 
         return output
Index: src/sas/sascalc/corfunc/corfunc_calculator.py
===================================================================
--- src/sas/sascalc/corfunc/corfunc_calculator.py	(revision a26f67f1457e7e39b79d4c3800c03bcaa208dff7)
+++ src/sas/sascalc/corfunc/corfunc_calculator.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -30,11 +30,11 @@
             self.start = start
             self.stop = stop
-            self._lastx = []
-            self._lasty = []
+            self._lastx = np.empty(0, dtype='d')
+            self._lasty = None
 
         def __call__(self, x):
             # If input is a single number, evaluate the function at that number
             # and return a single number
-            if type(x) == float or type(x) == int:
+            if isinstance(x, (float, int)):
                 return self._smoothed_function(np.array([x]))[0]
             # If input is a list, and is different to the last input, evaluate
@@ -42,7 +42,6 @@
             # the function was called, return the result that was calculated
             # last time instead of explicity evaluating the function again.
-            elif self._lastx == [] or x.tolist() != self._lastx.tolist():
-                self._lasty = self._smoothed_function(x)
-                self._lastx = x
+            if not np.array_equal(x, self._lastx):
+                self._lastx, self._lasty = x, self._smoothed_function(x)
             return self._lasty
 
@@ -88,5 +87,5 @@
         # Only process data of the class Data1D
         if not issubclass(data.__class__, Data1D):
-            raise ValueError("Data must be of the type DataLoader.Data1D")
+            raise ValueError("Correlation function cannot be computed with 2D data.")
 
         # Prepare the data
@@ -246,5 +245,5 @@
         """Fit the Guinier region of the curve"""
         A = np.vstack([q**2, np.ones(q.shape)]).T
-        return lstsq(A, np.log(iq))
+        return lstsq(A, np.log(iq), rcond=None)
 
     def _fit_porod(self, q, iq):
Index: src/sas/sascalc/data_util/calcthread.py
===================================================================
--- src/sas/sascalc/data_util/calcthread.py	(revision 574adc767a9e86744546f8edd6a23dc4f81914ad)
+++ src/sas/sascalc/data_util/calcthread.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -6,27 +6,22 @@
 from __future__ import print_function
 
-import traceback
 import sys
 import logging
+import traceback
+from time import sleep
+
 try:
     import _thread as thread
 except ImportError: # CRUFT: python 2 support
     import thread
-
-if sys.platform.count("darwin") > 0:
-    import time
-    stime = time.time()
-
-    def clock():
-        return time.time() - stime
-
-    def sleep(t):
-        return time.sleep(t)
-else:
-    from time import clock
-    from time import sleep
+try:
+    from time import perf_counter as clock
+except ImportError: # CRUFT: python < 3.3
+    if sys.platform.count("darwin") > 0:
+        from time import time as clock
+    else:
+        from time import clock
 
 logger = logging.getLogger(__name__)
-
 
 class CalcThread:
@@ -248,5 +243,5 @@
                 self.exception_handler(*sys.exc_info())
                 return
-            except Exception:
+            except Exception as exc:
                 pass
         logger.error(traceback.format_exc())
Index: src/sas/sascalc/data_util/nxsunit.py
===================================================================
--- src/sas/sascalc/data_util/nxsunit.py	(revision b011ecbdc80ebea6a89f794bb503745e7f6e5785)
+++ src/sas/sascalc/data_util/nxsunit.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -99,9 +99,8 @@
     Strip '^' from unit names.
 
-    * WARNING * this will incorrect transform 10^3 to 103.
-    """
-    s.update((k.replace('^',''),v)
-             for k, v in list(s.items())
-             if '^' in k)
+    * WARNING * this will incorrectly transform 10^3 to 103.
+    """
+    stripped = [(k.replace('^',''),v) for k, v in s.items() if '^' in k]
+    s.update(stripped)
 
 def _build_all_units():
Index: src/sas/sascalc/data_util/ordereddicttest.py
===================================================================
--- src/sas/sascalc/data_util/ordereddicttest.py	(revision b699768550de9d4b35b087234ec1d2a461922bab)
+++ src/sas/sascalc/data_util/ordereddicttest.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -147,8 +147,8 @@
                     ]):
             self.assert_(dup is not od)
-            self.assertEquals(dup, od)
-            self.assertEquals(list(dup.items()), list(od.items()))
-            self.assertEquals(len(dup), len(od))
-            self.assertEquals(type(dup), type(od))
+            self.assertEqual(dup, od)
+            self.assertEqual(list(dup.items()), list(od.items()))
+            self.assertEqual(len(dup), len(od))
+            self.assertEqual(type(dup), type(od))
 
     def test_repr(self):
Index: src/sas/sascalc/data_util/registry.py
===================================================================
--- src/sas/sascalc/data_util/registry.py	(revision a26f67f1457e7e39b79d4c3800c03bcaa208dff7)
+++ src/sas/sascalc/data_util/registry.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -148,3 +148,3 @@
             # If file has associated loader(s) and they;ve failed
             raise last_exc
-        raise NoKnownLoaderException(e.message)  # raise generic exception
+        raise NoKnownLoaderException(str(message))  # raise generic exception
Index: src/sas/sascalc/data_util/uncertainty.py
===================================================================
--- src/sas/sascalc/data_util/uncertainty.py	(revision 574adc767a9e86744546f8edd6a23dc4f81914ad)
+++ src/sas/sascalc/data_util/uncertainty.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -19,5 +19,5 @@
 import numpy as np
 
-from .import err1d
+from . import err1d
 from .formatnum import format_uncertainty
 
Index: src/sas/sascalc/dataloader/data_info.py
===================================================================
--- src/sas/sascalc/dataloader/data_info.py	(revision 4fdcc659bc3efafa4310cdbe335d80ef80d1b7bb)
+++ src/sas/sascalc/dataloader/data_info.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -26,4 +26,5 @@
 import numpy as np
 import math
+from math import fabs
 
 class plottable_1D(object):
@@ -656,5 +657,5 @@
         return self._perform_operation(other, operation)
 
-    def __div__(self, other):
+    def __truediv__(self, other):
         """
         Divided a data set by another
@@ -667,6 +668,7 @@
             return a/b
         return self._perform_operation(other, operation)
-
-    def __rdiv__(self, other):
+    __div__ = __truediv__
+
+    def __rtruediv__(self, other):
         """
         Divided a data set by another
@@ -679,4 +681,5 @@
             return b/a
         return self._perform_operation(other, operation)
+    __rdiv__ = __rtruediv__
 
     def __or__(self, other):
@@ -800,5 +803,5 @@
             TOLERANCE = 0.01
             for i in range(len(self.x)):
-                if math.fabs((self.x[i] - other.x[i])/self.x[i]) > TOLERANCE:
+                if fabs(self.x[i] - other.x[i]) > self.x[i]*TOLERANCE:
                     msg = "Incompatible data sets: x-values do not match"
                     raise ValueError(msg)
@@ -1032,8 +1035,8 @@
                 raise ValueError(msg)
             for ind in range(len(self.data)):
-                if math.fabs((self.qx_data[ind] - other.qx_data[ind])/self.qx_data[ind]) > TOLERANCE:
+                if fabs(self.qx_data[ind] - other.qx_data[ind]) > fabs(self.qx_data[ind])*TOLERANCE:
                     msg = "Incompatible data sets: qx-values do not match: %s %s" % (self.qx_data[ind], other.qx_data[ind])
                     raise ValueError(msg)
-                if math.fabs((self.qy_data[ind] - other.qy_data[ind])/self.qy_data[ind]) > TOLERANCE:
+                if fabs(self.qy_data[ind] - other.qy_data[ind]) > fabs(self.qy_data[ind])*TOLERANCE:
                     msg = "Incompatible data sets: qy-values do not match: %s %s" % (self.qy_data[ind], other.qy_data[ind])
                     raise ValueError(msg)
Index: src/sas/sascalc/dataloader/loader.py
===================================================================
--- src/sas/sascalc/dataloader/loader.py	(revision b1ec23da8185a2a0dbda947ce190774e0b87aa90)
+++ src/sas/sascalc/dataloader/loader.py	(revision b1ec23da8185a2a0dbda947ce190774e0b87aa90)
@@ -169,7 +169,7 @@
                         if self._identify_plugin(module):
                             readers_found += 1
-                    except:
+                    except Exception as exc:
                         msg = "Loader: Error importing "
-                        msg += "%s\n  %s" % (item, sys.exc_value)
+                        msg += "%s\n  %s" % (item, exc)
                         logger.error(msg)
 
@@ -191,12 +191,12 @@
                                 if self._identify_plugin(module):
                                     readers_found += 1
-                            except:
+                            except Exception as exc:
                                 msg = "Loader: Error importing"
-                                msg += " %s\n  %s" % (mfile, sys.exc_value)
+                                msg += " %s\n  %s" % (mfile, exc)
                                 logger.error(msg)
 
-                    except:
+                    except Exception as exc:
                         msg = "Loader: Error importing "
-                        msg += " %s\n  %s" % (item, sys.exc_value)
+                        msg += " %s\n  %s" % (item, exc)
                         logger.error(msg)
 
@@ -242,7 +242,7 @@
                     self.writers[ext].append(loader.write)
 
-            except:
+            except Exception as exc:
                 msg = "Loader: Error accessing"
-                msg += " Reader in %s\n  %s" % (module.__name__, sys.exc_value)
+                msg += " Reader in %s\n  %s" % (module.__name__, exc)
                 logger.error(msg)
         return reader_found
@@ -275,7 +275,7 @@
                     self.wildcards.append(wcard)
 
-        except:
+        except Exception as exc:
             msg = "Loader: Error accessing Reader "
-            msg += "in %s\n  %s" % (loader.__name__, sys.exc_value)
+            msg += "in %s\n  %s" % (loader.__name__, exc)
             logger.error(msg)
         return reader_found
@@ -320,7 +320,7 @@
                         self.writers[ext].insert(0, loader.write)
 
-            except:
+            except Exception as exc:
                 msg = "Loader: Error accessing Reader"
-                msg += " in %s\n  %s" % (module.__name__, sys.exc_value)
+                msg += " in %s\n  %s" % (module.__name__, exc)
                 logger.error(msg)
         return reader_found
Index: src/sas/sascalc/dataloader/manipulations.py
===================================================================
--- src/sas/sascalc/dataloader/manipulations.py	(revision 574adc767a9e86744546f8edd6a23dc4f81914ad)
+++ src/sas/sascalc/dataloader/manipulations.py	(revision e4e9162012e4f9bbd8ce8fe25bb99135a3a37e40)
@@ -928,22 +928,23 @@
 
         # Organize the results
-        for i in range(self.nbins):
-            y[i] = y[i] / y_counts[i]
-            y_err[i] = math.sqrt(y_err[i]) / y_counts[i]
-
-            # The type of averaging: phi,q2, or q
-            # Calculate x[i]should be at the center of the bin
+        with np.errstate(divide='ignore', invalid='ignore'):
+            y = y/y_counts
+            y_err = np.sqrt(y_err)/y_counts
+            # The type of averaging: phi, q2, or q
+            # Calculate x values at the center of the bin
             if run.lower() == 'phi':
-                x[i] = (self.phi_max - self.phi_min) / self.nbins * \
-                    (1.0 * i + 0.5) + self.phi_min
+                step = (self.phi_max - self.phi_min) / self.nbins
+                x = (np.arange(self.nbins) + 0.5) * step + self.phi_min
             else:
-                # We take the center of ring area, not radius.
-                # This is more accurate than taking the radial center of ring.
-                # delta_r = (self.r_max - self.r_min) / self.nbins
-                # r_inner = self.r_min + delta_r * i
-                # r_outer = r_inner + delta_r
-                # x[i] = math.sqrt((r_inner * r_inner + r_outer * r_outer) / 2)
-                x[i] = x[i] / y_counts[i]
-        y_err[y_err == 0] = np.average(y_err)
+                # set q to the average of the q values within each bin
+                x = x/y_counts
+
+                ### Alternate algorithm
+                ## We take the center of ring area, not radius.
+                ## This is more accurate than taking the radial center of ring.
+                #step = (self.r_max - self.r_min) / self.nbins
+                #r_inner = self.r_min + step * np.arange(self.nbins)
+                #x = math.sqrt((r_inner**2 + (r_inner + step)**2) / 2)
+
         idx = (np.isfinite(y) & np.isfinite(y_err))
         if x_err is not None:
Index: src/sas/sascalc/dataloader/readers/associations.py
===================================================================
--- src/sas/sascalc/dataloader/readers/associations.py	(revision c7c814358a478ddea9a6f8b57a46374c443b4776)
+++ src/sas/sascalc/dataloader/readers/associations.py	(revision c7c814358a478ddea9a6f8b57a46374c443b4776)
@@ -54,6 +54,6 @@
                 exec("loader.associate_file_type('%s', %s)"
                      % (ext.upper(), reader))
-            except:
+            except Exception as exc:
                 msg = "read_associations: skipping association"
-                msg += " for %s\n  %s" % (ext.lower(), sys.exc_value)
+                msg += " for %s\n  %s" % (ext.lower(), exc)
                 logger.error(msg)
Index: src/sas/sascalc/dataloader/readers/cansas_reader.py
===================================================================
--- src/sas/sascalc/dataloader/readers/cansas_reader.py	(revision 058f6c331803fd9d3a8627da92364a3b0c0c29b5)
+++ src/sas/sascalc/dataloader/readers/cansas_reader.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -1239,9 +1239,8 @@
                         conv = Converter(units)
                         setattrchain(storage, variable, conv(value, units=local_unit))
-                    except Exception:
-                        _, exc_value, _ = sys.exc_info()
+                    except Exception as exc:
                         err_mess = "CanSAS reader: could not convert"
                         err_mess += " %s unit [%s]; expecting [%s]\n  %s" \
-                            % (variable, units, local_unit, exc_value)
+                            % (variable, units, local_unit, exc)
                         self.errors.add(err_mess)
                         if optional:
Index: src/sas/sascalc/fit/expression.py
===================================================================
--- src/sas/sascalc/fit/expression.py	(revision 574adc767a9e86744546f8edd6a23dc4f81914ad)
+++ src/sas/sascalc/fit/expression.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -210,5 +210,5 @@
 
     #print("Function: "+functiondef)
-    exec functiondef in globals,locals
+    exec(functiondef, globals, locals)
     retfn = locals['eval_expressions']
 
Index: src/sas/sascalc/fit/models.py
===================================================================
--- src/sas/sascalc/fit/models.py	(revision 0f0fe42a04c7184507c90d05228beb99cab4a718)
+++ src/sas/sascalc/fit/models.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -12,4 +12,6 @@
 import py_compile
 import shutil
+
+from six import reraise
 
 from sasmodels.sasview_model import load_custom_model, load_standard_models
@@ -62,8 +64,7 @@
     try:
         new_instance = model()
-    except Exception:
-        msg = "Plugin %s error in __init__ \n\t: %s %s\n" % (str(name),
-                                                             str(sys.exc_type),
-                                                             sys.exc_info()[1])
+    except Exception as exc:
+        msg = ("Plugin %s error in __init__ \n\t: %s %s\n"
+               % (name, type(exc), exc))
         plugin_log(msg)
         return None
@@ -72,7 +73,7 @@
         try:
             value = new_instance.function()
-        except Exception:
+        except Exception as exc:
             msg = "Plugin %s: error writing function \n\t :%s %s\n " % \
-                    (str(name), str(sys.exc_type), sys.exc_info()[1])
+                    (str(name), str(type(exc)), exc)
             plugin_log(msg)
             return None
@@ -139,5 +140,5 @@
         if type is not None and issubclass(type, py_compile.PyCompileError):
             print("Problem with", repr(value))
-            raise type, value, tb
+            reraise(type, value, tb)
         return 1
 
@@ -153,6 +154,6 @@
         compileall.compile_dir(dir=dir, ddir=dir, force=0,
                                quiet=report_problem)
-    except Exception:
-        return sys.exc_info()[1]
+    except Exception as exc:
+        return exc
     return None
 
@@ -185,5 +186,5 @@
                     model.name = PLUGIN_NAME_BASE + model.name
                 plugins[model.name] = model
-            except Exception:
+            except Exception as exc:
                 msg = traceback.format_exc()
                 msg += "\nwhile accessing model in %r" % path
Index: src/sas/sascalc/fit/pagestate.py
===================================================================
--- src/sas/sascalc/fit/pagestate.py	(revision 863ac2c13917d1e25dc3fe0061ef11ef07b02366)
+++ src/sas/sascalc/fit/pagestate.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -650,7 +650,7 @@
                     #Truncating string so print doesn't complain of being outside margins
                     if sys.platform != "win32":
-                        MAX_STRING_LENGHT = 50
-                        if len(file_value) > MAX_STRING_LENGHT:
-                            file_value = "File name:.."+file_value[-MAX_STRING_LENGHT+10:]
+                        MAX_STRING_LENGTH = 50
+                        if len(file_value) > MAX_STRING_LENGTH:
+                            file_value = "File name:.."+file_value[-MAX_STRING_LENGTH+10:]
                     file_name = CENTRE % file_value
                     if len(title) == 0:
@@ -905,5 +905,5 @@
                 doc_model = newdoc.createElement('model_list_item')
                 doc_model.setAttribute('checked', str(model[0].GetValue()))
-                keys = model[1].keys()
+                keys = list(model[1].keys())
                 doc_model.setAttribute('name', str(keys[0]))
                 values = model[1].get(keys[0])
@@ -964,5 +964,5 @@
         if node.get('version'):
             # Get the version for model conversion purposes
-            x = re.sub('[^\d.]', '', node.get('version'))
+            x = re.sub(r'[^\d.]', '', node.get('version'))
             self.version = tuple(int(e) for e in str.split(x, "."))
             # The tuple must be at least 3 items long
@@ -984,7 +984,7 @@
                 try:
                     self.timestamp = float(entry.get('epoch'))
-                except Exception:
+                except Exception as exc:
                     msg = "PageState.fromXML: Could not"
-                    msg += " read timestamp\n %s" % sys.exc_value
+                    msg += " read timestamp\n %s" % exc
                     logger.error(msg)
 
@@ -1282,5 +1282,5 @@
                         if isinstance(data.run_name, dict):
                             # Note: key order in dict is not guaranteed, so sort
-                            name = data.run_name.keys()[0]
+                            name = list(data.run_name.keys())[0]
                         else:
                             name = data.run_name
Index: src/sas/sascalc/invariant/invariant.py
===================================================================
--- src/sas/sascalc/invariant/invariant.py	(revision 574adc767a9e86744546f8edd6a23dc4f81914ad)
+++ src/sas/sascalc/invariant/invariant.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -344,5 +344,6 @@
         else:
             A = np.vstack([linearized_data.x / linearized_data.dy, 1.0 / linearized_data.dy]).T
-            (p, residuals, _, _) = np.linalg.lstsq(A, linearized_data.y / linearized_data.dy)
+            p, residuals, _, _ = np.linalg.lstsq(A, linearized_data.y / linearized_data.dy,
+                                                 rcond=None)
 
             # Get the covariance matrix, defined as inv_cov = a_transposed * a
Index: src/sas/sascalc/pr/distance_explorer.py
===================================================================
--- src/sas/sascalc/pr/distance_explorer.py	(revision 959eb0181ad06828a748f04512f953aad5b31659)
+++ src/sas/sascalc/pr/distance_explorer.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -99,8 +99,8 @@
                 results.pos_err.append(pos_err)
                 results.osc.append(osc)
-            except:
+            except Exception as exc:
                 # This inversion failed, skip this D_max value
                 msg = "ExploreDialog: inversion failed for "
-                msg += "D_max=%s\n %s" % (str(d), sys.exc_value)
+                msg += "D_max=%s\n %s" % (str(d), exc)
                 results.errors.append(msg)
 
Index: src/sas/sascalc/pr/fit/expression.py
===================================================================
--- src/sas/sascalc/pr/fit/expression.py	(revision 574adc767a9e86744546f8edd6a23dc4f81914ad)
+++ src/sas/sascalc/pr/fit/expression.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -210,5 +210,5 @@
 
     #print("Function: "+functiondef)
-    exec functiondef in globals,locals
+    exec(functiondef, globals, locals)
     retfn = locals['eval_expressions']
 
Index: src/sas/sascalc/pr/num_term.py
===================================================================
--- src/sas/sascalc/pr/num_term.py	(revision 3e6829d03839dc7a60382a887dc7f27da1c50c8f)
+++ src/sas/sascalc/pr/num_term.py	(revision 3e6829d03839dc7a60382a887dc7f27da1c50c8f)
@@ -182,6 +182,6 @@
                 data_y = np.append(data_y, test_y)
                 data_err = np.append(data_err, err)
-            except:
-                logger.error(sys.exc_value)
+            except Exception as exc:
+                logger.error(exc)
 
     return data_x, data_y, data_err
Index: src/sas/sascalc/realspace/VolumeCanvas.py
===================================================================
--- src/sas/sascalc/realspace/VolumeCanvas.py	(revision 98e3f24eb417c960360e014aae48605345a05266)
+++ src/sas/sascalc/realspace/VolumeCanvas.py	(revision e090ba909aeb28ce2f0504a77e5a800070907873)
@@ -472,5 +472,5 @@
             Return a list of the shapes
         """
-        return self.shapes.keys()
+        return list(self.shapes.keys())
 
     def _addSingleShape(self, shapeDesc):
Index: test/calculatorview/test/utest_gui_sld.py
===================================================================
--- test/calculatorview/test/utest_gui_sld.py	(revision 959eb0181ad06828a748f04512f953aad5b31659)
+++ test/calculatorview/test/utest_gui_sld.py	(revision 88d2e70bb28d8f9c855c86d94ad8ddd63154277b)
@@ -33,5 +33,5 @@
         self.sld_frame.panel.ProcessEvent(clickEvent)
         bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour()
-        self.assert_(bkg.GetAsString() == 'pink')
+        self.assertTrue(bkg.GetAsString() == 'pink')
         #compute invariant without entering a value for compound
         self.sld_frame.panel.compound_ctl.SetValue("")
@@ -39,5 +39,5 @@
         self.sld_frame.panel.ProcessEvent(clickEvent)
         bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour()
-        self.assert_(bkg.GetAsString() == 'pink')
+        self.assertTrue(bkg.GetAsString() == 'pink')
         #compute invariant without entering a value for compound
         self.sld_frame.panel.compound_ctl.SetValue("H2O")
@@ -45,5 +45,5 @@
         self.sld_frame.panel.ProcessEvent(clickEvent)
         bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour()
-        self.assert_(bkg.GetAsString() == 'white')
+        self.assertTrue(bkg.GetAsString() == 'white')
        
     def testDensityTextCtrl(self):
@@ -59,5 +59,5 @@
         self.sld_frame.panel.ProcessEvent(clickEvent)
         bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour()
-        self.assert_(bkg.GetAsString() == 'pink')
+        self.assertTrue(bkg.GetAsString() == 'pink')
         #compute invariant without entering a value for density
         self.sld_frame.panel.compound_ctl.SetValue("H2O")
@@ -65,5 +65,5 @@
         self.sld_frame.panel.ProcessEvent(clickEvent)
         bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour()
-        self.assert_(bkg.GetAsString() == 'pink')
+        self.assertTrue(bkg.GetAsString() == 'pink')
         #compute invariant without entering a value for density
         self.sld_frame.panel.compound_ctl.SetValue("H2O")
@@ -71,5 +71,5 @@
         self.sld_frame.panel.ProcessEvent(clickEvent)
         bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour()
-        self.assert_(bkg.GetAsString() == 'white')
+        self.assertTrue(bkg.GetAsString() == 'white')
         
     def testWavelengthTextCtrl(self):
@@ -86,5 +86,5 @@
         self.sld_frame.panel.ProcessEvent(clickEvent)
         bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour()
-        self.assert_(bkg.GetAsString() == 'pink')
+        self.assertTrue(bkg.GetAsString() == 'pink')
         #compute invariant without entering a value for wavelegnth
         self.sld_frame.panel.compound_ctl.SetValue("H2O")
@@ -93,11 +93,11 @@
         self.sld_frame.panel.ProcessEvent(clickEvent)
         cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour()
-        self.assert_(cp_bkg.GetAsString() == 'white')
+        self.assertTrue(cp_bkg.GetAsString() == 'white')
         ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour()
-        self.assert_(ds_bkg.GetAsString() == 'white')
+        self.assertTrue(ds_bkg.GetAsString() == 'white')
         wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour()
         value = self.sld_frame.panel.wavelength_ctl.GetValue()
-        self.assert_(wv_bkg.GetAsString() == 'white')
-        self.assert_(float(value) == WAVELENGTH)
+        self.assertTrue(wv_bkg.GetAsString() == 'white')
+        self.assertTrue(float(value) == WAVELENGTH)
         sld_real = self.sld_frame.panel.neutron_sld_real_ctl.GetValue()
         sld_im = self.sld_frame.panel.neutron_sld_im_ctl.GetValue()
@@ -110,17 +110,17 @@
         length = self.sld_frame.panel.neutron_length_ctl.GetValue()
         
-        self.assertAlmostEquals(float(sld_real), 1.04e-6, 1)
-        self.assertAlmostEquals(float(sld_im), -1.5e-7, 1)
+        self.assertAlmostEqual(float(sld_real), 1.04e-6, 1)
+        self.assertAlmostEqual(float(sld_im), -1.5e-7, 1)
         #test absorption value
-        self.assertAlmostEquals(float(abs) , 0.0741, 2)
-        self.assertAlmostEquals(float(incoh), 5.62, 2)
+        self.assertAlmostEqual(float(abs) , 0.0741, 2)
+        self.assertAlmostEqual(float(incoh), 5.62, 2)
         #Test length
-        self.assertAlmostEquals(float(length), 0.1755, 2)
+        self.assertAlmostEqual(float(length), 0.1755, 2)
         #test Cu sld
-        self.assertAlmostEquals(float(cu_real), 9.46e-6, 1)
-        self.assertAlmostEquals(float(cu_im), 3.01e-8)
+        self.assertAlmostEqual(float(cu_real), 9.46e-6, 1)
+        self.assertAlmostEqual(float(cu_im), 3.01e-8)
         # test Mo sld
-        self.assertAlmostEquals(float(mo_real), 9.43e-6)
-        self.assertAlmostEquals(float(mo_im), 5.65e-7, 1)
+        self.assertAlmostEqual(float(mo_real), 9.43e-6)
+        self.assertAlmostEqual(float(mo_im), 5.65e-7, 1)
         #compute invariant with all correct inputs value
         self.sld_frame.panel.compound_ctl.SetValue("H2O")
@@ -130,6 +130,6 @@
         bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour()
         value = self.sld_frame.panel.wavelength_ctl.GetValue()
-        self.assert_(bkg.GetAsString() == 'white')
-        self.assert_(float(value) == WAVELENGTH/2)
+        self.assertTrue(bkg.GetAsString() == 'white')
+        self.assertTrue(float(value) == WAVELENGTH/2)
         
     def testSomeCombination(self):
@@ -145,9 +145,9 @@
         self.sld_frame.panel.ProcessEvent(clickEvent)
         cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour()
-        self.assert_(cp_bkg.GetAsString() == 'white')
+        self.assertTrue(cp_bkg.GetAsString() == 'white')
         ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour()
-        self.assert_(ds_bkg.GetAsString() == 'white')
+        self.assertTrue(ds_bkg.GetAsString() == 'white')
         wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour()
-        self.assert_(wv_bkg.GetAsString() == 'pink')
+        self.assertTrue(wv_bkg.GetAsString() == 'pink')
         #density, wavelength is invalid
         self.sld_frame.panel.compound_ctl.SetValue("H2O")
@@ -158,9 +158,9 @@
         self.sld_frame.panel.ProcessEvent(clickEvent)
         cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour()
-        self.assert_(cp_bkg.GetAsString() == 'white')
+        self.assertTrue(cp_bkg.GetAsString() == 'white')
         ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour()
-        self.assert_(ds_bkg.GetAsString() == 'pink')
+        self.assertTrue(ds_bkg.GetAsString() == 'pink')
         wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour()
-        self.assert_(wv_bkg.GetAsString() == 'pink')
+        self.assertTrue(wv_bkg.GetAsString() == 'pink')
         #density, wavelength is invalid
         self.sld_frame.panel.compound_ctl.SetValue("invalid compound")
@@ -171,11 +171,11 @@
         self.sld_frame.panel.ProcessEvent(clickEvent)
         cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour()
-        self.assert_(cp_bkg.GetAsString() == 'pink')
+        self.assertTrue(cp_bkg.GetAsString() == 'pink')
         ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour()
-        self.assert_(ds_bkg.GetAsString() == 'pink')
+        self.assertTrue(ds_bkg.GetAsString() == 'pink')
         wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour()
-        self.assert_(wv_bkg.GetAsString() == 'white')
+        self.assertTrue(wv_bkg.GetAsString() == 'white')
         value = self.sld_frame.panel.wavelength_ctl.GetValue()
-        self.assert_(float(value) == WAVELENGTH)
+        self.assertTrue(float(value) == WAVELENGTH)
 
         
Index: test/pr_inversion/test/utest_explorer.py
===================================================================
--- test/pr_inversion/test/utest_explorer.py	(revision f53d684ed4a54de3601e5f4bc601f78376d98e83)
+++ test/pr_inversion/test/utest_explorer.py	(revision 1852b17578f93eff22ccdad62975a4cabdd21da7)
@@ -3,10 +3,14 @@
 """
 
+import sys
 import os.path
 import unittest, math, numpy
-from utest_invertor import load
 from sas.sascalc.pr.invertor import Invertor
 from sas.sascalc.pr.distance_explorer import DistExplorer
 
+try:
+    from utest_invertor import load
+except ImportError:
+    from .utest_invertor import load
 
 def find(filename):
@@ -36,5 +40,5 @@
         self.assertEqual(len(results.errors), 0)
         self.assertEqual(len(results.chi2), 25)
-        
+
 if __name__ == '__main__':
     unittest.main()
Index: test/sascalculator/test/utest_sld.py
===================================================================
--- test/sascalculator/test/utest_sld.py	(revision a50da8251d0d92f4c04979ecac4b78ac2c43b925)
+++ test/sascalculator/test/utest_sld.py	(revision 88d2e70bb28d8f9c855c86d94ad8ddd63154277b)
@@ -51,17 +51,17 @@
                                   molecule_formula=self.sld_formula)
         #test sld
-        self.assertAlmostEquals(sld_real * _SCALE, -5.6e-7, 1)
-        self.assertAlmostEquals(sld_im * _SCALE, 0)
+        self.assertAlmostEqual(sld_real * _SCALE, -5.6e-7, 1)
+        self.assertAlmostEqual(sld_im * _SCALE, 0)
         #test absorption value
-        self.assertAlmostEquals(abs, 0.0741, 2)
-        self.assertAlmostEquals(incoh, 5.62, 2)
+        self.assertAlmostEqual(abs, 0.0741, 2)
+        self.assertAlmostEqual(incoh, 5.62, 2)
         #Test length
-        self.assertAlmostEquals(length, 0.1755, 3)
+        self.assertAlmostEqual(length, 0.1755, 3)
         #test Cu sld
-        self.assertAlmostEquals(cu_real * _SCALE, 9.46e-6, 1)
-        self.assertAlmostEquals(cu_im * _SCALE, 3.01e-8)
+        self.assertAlmostEqual(cu_real * _SCALE, 9.46e-6, 1)
+        self.assertAlmostEqual(cu_im * _SCALE, 3.01e-8)
         # test Mo sld
-        self.assertAlmostEquals(mo_real * _SCALE, 9.43e-6)
-        self.assertAlmostEquals(mo_im * _SCALE, 5.65e-7,1)
+        self.assertAlmostEqual(mo_real * _SCALE, 9.43e-6)
+        self.assertAlmostEqual(mo_im * _SCALE, 5.65e-7,1)
 
 
@@ -91,17 +91,17 @@
                                   molecule_formula=self.sld_formula)
         #test sld
-        self.assertAlmostEquals(sld_real * _SCALE, 6.33e-6, 1)
-        self.assertAlmostEquals(sld_im * _SCALE, 0)
+        self.assertAlmostEqual(sld_real * _SCALE, 6.33e-6, 1)
+        self.assertAlmostEqual(sld_im * _SCALE, 0)
         #test absorption value
-        self.assertAlmostEquals(abs, 1.35e-4, 2)
-        self.assertAlmostEquals(incoh, 0.138, 2)
+        self.assertAlmostEqual(abs, 1.35e-4, 2)
+        self.assertAlmostEqual(incoh, 0.138, 2)
         #Test length
-        self.assertAlmostEquals(length, 1.549, 3)
+        self.assertAlmostEqual(length, 1.549, 3)
         #test Cu sld
-        self.assertAlmostEquals(cu_real * _SCALE, 9.36e-6, 1)
-        self.assertAlmostEquals(cu_im * _SCALE, 2.98e-8)
+        self.assertAlmostEqual(cu_real * _SCALE, 9.36e-6, 1)
+        self.assertAlmostEqual(cu_im * _SCALE, 2.98e-8)
         # test Mo sld
-        self.assertAlmostEquals(mo_real * _SCALE, 9.33e-6)
-        self.assertAlmostEquals(mo_im * _SCALE, 5.59e-9,1)
+        self.assertAlmostEqual(mo_real * _SCALE, 9.33e-6)
+        self.assertAlmostEqual(mo_im * _SCALE, 5.59e-9,1)
 
 
@@ -131,17 +131,17 @@
                                   molecule_formula=self.sld_formula)
         #test sld
-        self.assertAlmostEquals(sld_real * _SCALE, 1.04e-6, 1)
-        self.assertAlmostEquals(sld_im * _SCALE, -1.5e-7, 1)
+        self.assertAlmostEqual(sld_real * _SCALE, 1.04e-6, 1)
+        self.assertAlmostEqual(sld_im * _SCALE, -1.5e-7, 1)
         #test absorption value
-        self.assertAlmostEquals(abs, 180.0,0)
-        self.assertAlmostEquals(incoh, 0.0754, 2)
+        self.assertAlmostEqual(abs, 180.0,0)
+        self.assertAlmostEqual(incoh, 0.0754, 2)
         #Test length
-        self.assertAlmostEquals(length, 0.005551, 4)
+        self.assertAlmostEqual(length, 0.005551, 4)
         #test Cu sld
-        self.assertAlmostEquals(cu_real * _SCALE, 2.89e-5, 1)
-        self.assertAlmostEquals(cu_im * _SCALE, 2.81e-6)
+        self.assertAlmostEqual(cu_real * _SCALE, 2.89e-5, 1)
+        self.assertAlmostEqual(cu_im * _SCALE, 2.81e-6)
         # test Mo sld
-        self.assertAlmostEquals(mo_real * _SCALE, 2.84e-5, 1)
-        self.assertAlmostEquals(mo_im * _SCALE, 7.26e-7,1)
+        self.assertAlmostEqual(mo_real * _SCALE, 2.84e-5, 1)
+        self.assertAlmostEqual(mo_im * _SCALE, 7.26e-7,1)
 
 if __name__ == '__main__':
Index: test/sasdataloader/plugins/test_reader.py
===================================================================
--- test/sasdataloader/plugins/test_reader.py	(revision aaf5e497ff1af2aa7b8b3d361ab951e2a0ca7c93)
+++ test/sasdataloader/plugins/test_reader.py	(revision 88d2e70bb28d8f9c855c86d94ad8ddd63154277b)
@@ -40,5 +40,5 @@
                     input_f =  open(path,'r')
                 except :
-                    raise  RuntimeError, "ascii_reader: cannot open %s" % path
+                    raise  RuntimeError("ascii_reader: cannot open %s" % path)
                 buff = input_f.read()
                 lines = buff.split('\n')
@@ -55,5 +55,5 @@
                 return output
         else:
-            raise RuntimeError, "%s is not a file" % path
+            raise RuntimeError("%s is not a file" % path)
         return None
     
Index: test/sasdataloader/test/utest_abs_reader.py
===================================================================
--- test/sasdataloader/test/utest_abs_reader.py	(revision d96744de9a57d30dd495ba032913ed4268252bf5)
+++ test/sasdataloader/test/utest_abs_reader.py	(revision 4cbb2f52e9c512eb469ba3ddf768c686364d3748)
@@ -357,5 +357,5 @@
         self.assertEqual(self.data.dy[0], 3)
         self.assertEqual(self.data.x[1], 0.03)
-        self.assertAlmostEquals(self.data.y[1], 1001.0)
+        self.assertAlmostEqual(self.data.y[1], 1001.0)
         self.assertEqual(self.data.dxl[1], 0.005)
         self.assertEqual(self.data.dxw[1], 0.001)
Index: test/sasinvariant/test/utest_data_handling.py
===================================================================
--- test/sasinvariant/test/utest_data_handling.py	(revision f53d684ed4a54de3601e5f4bc601f78376d98e83)
+++ test/sasinvariant/test/utest_data_handling.py	(revision 88d2e70bb28d8f9c855c86d94ad8ddd63154277b)
@@ -45,6 +45,6 @@
 
         # Test results
-        self.assertAlmostEquals(p[0], 1.0, 5)
-        self.assertAlmostEquals(p[1], 0.0, 5)
+        self.assertAlmostEqual(p[0], 1.0, 5)
+        self.assertAlmostEqual(p[1], 0.0, 5)
 
     def test_fit_linear_data_with_noise(self):
@@ -74,6 +74,6 @@
 
         # Test results
-        self.assertAlmostEquals(p[0], 1.0, 5)
-        self.assertAlmostEquals(p[1], 0.0, 5)
+        self.assertAlmostEqual(p[0], 1.0, 5)
+        self.assertAlmostEqual(p[1], 0.0, 5)
 
     def test_fit_linear_data_with_noise_and_fixed_par(self):
@@ -506,5 +506,5 @@
         for i in range(len(self.data.x)):
             value  = math.fabs(test_y[i]-self.data.y[i])/self.data.y[i]
-            self.assert_(value < 0.001)
+            self.assertTrue(value < 0.001)
             
 class TestDataExtraLowSlitGuinier(unittest.TestCase):
@@ -553,9 +553,9 @@
 
         test_y = inv._low_extrapolation_function.evaluate_model(x=self.data.x[:inv._low_extrapolation_npts])
-        self.assert_(len(test_y) == len(self.data.y[:inv._low_extrapolation_npts]))
+        self.assertTrue(len(test_y) == len(self.data.y[:inv._low_extrapolation_npts]))
         
         for i in range(inv._low_extrapolation_npts):
             value  = math.fabs(test_y[i]-self.data.y[i])/self.data.y[i]
-            self.assert_(value < 0.001)
+            self.assertTrue(value < 0.001)
             
     def test_low_data(self):
@@ -589,8 +589,8 @@
                                                npts = inv._low_extrapolation_npts) 
         test_y = data_in_range.y
-        self.assert_(len(test_y) == len(self.data.y[:inv._low_extrapolation_npts]))
+        self.assertTrue(len(test_y) == len(self.data.y[:inv._low_extrapolation_npts]))
         for i in range(inv._low_extrapolation_npts):
             value  = math.fabs(test_y[i]-self.data.y[i])/self.data.y[i]
-            self.assert_(value < 0.001)    
+            self.assertTrue(value < 0.001)
        
             
@@ -642,9 +642,9 @@
         
         test_y = inv._high_extrapolation_function.evaluate_model(x=self.data.x[start: ])
-        self.assert_(len(test_y) == len(self.data.y[start:]))
+        self.assertTrue(len(test_y) == len(self.data.y[start:]))
         
         for i in range(len(self.data.x[start:])):
             value  = math.fabs(test_y[i]-self.data.y[start+i])/self.data.y[start+i]
-            self.assert_(value < 0.001)
+            self.assertTrue(value < 0.001)
             
     def test_high_data(self):
@@ -677,8 +677,8 @@
                                                npts = inv._high_extrapolation_npts) 
         test_y = data_in_range.y
-        self.assert_(len(test_y) == len(self.data.y[start:]))
+        self.assertTrue(len(test_y) == len(self.data.y[start:]))
         temp = self.data.y[start:]
         
         for i in range(len(self.data.x[start:])):
             value  = math.fabs(test_y[i]- temp[i])/temp[i]
-            self.assert_(value < 0.001)                
+            self.assertTrue(value < 0.001)
Index: test/sasinvariant/test/utest_use_cases.py
===================================================================
--- test/sasinvariant/test/utest_use_cases.py	(revision f53d684ed4a54de3601e5f4bc601f78376d98e83)
+++ test/sasinvariant/test/utest_use_cases.py	(revision 88d2e70bb28d8f9c855c86d94ad8ddd63154277b)
@@ -39,6 +39,6 @@
 
         # Test results
-        self.assertAlmostEquals(p[0], 2.3983,3)
-        self.assertAlmostEquals(p[1], 0.87833,3)
+        self.assertAlmostEqual(p[0], 2.3983,3)
+        self.assertAlmostEqual(p[1], 0.87833,3)
 
     def test_fit_line_data_fixed(self):
@@ -54,6 +54,6 @@
 
         # Test results
-        self.assertAlmostEquals(p[0], 4)
-        self.assertAlmostEquals(p[1], -4.0676,3)
+        self.assertAlmostEqual(p[0], 4)
+        self.assertAlmostEqual(p[1], -4.0676,3)
 
 
@@ -78,6 +78,6 @@
 
         # Test results
-        self.assertAlmostEquals(p[0], 2.4727,3)
-        self.assertAlmostEquals(p[1], 0.6,3)
+        self.assertAlmostEqual(p[0], 2.4727,3)
+        self.assertAlmostEqual(p[1], 0.6,3)
 
     def test_fit_line_data_fixed_no_weight(self):
@@ -93,6 +93,6 @@
 
         # Test results
-        self.assertAlmostEquals(p[0], 4)
-        self.assertAlmostEquals(p[1], -7.8,3)
+        self.assertAlmostEqual(p[0], 4)
+        self.assertAlmostEqual(p[1], -7.8,3)
 
 
@@ -132,7 +132,7 @@
 
         # Test results
-        self.assertAlmostEquals(qstar, 7.48959e-5,2)
-        self.assertAlmostEquals(v, 0.005644689, 4)
-        self.assertAlmostEquals(s , 941.7452, 3)
+        self.assertAlmostEqual(qstar, 7.48959e-5,2)
+        self.assertAlmostEqual(v, 0.005644689, 4)
+        self.assertAlmostEqual(s , 941.7452, 3)
 
     def test_use_case_2(self):
@@ -153,7 +153,7 @@
         s, ds = inv.get_surface_with_error(contrast=2.6e-6, porod_const=2)
         # Test results
-        self.assertAlmostEquals(qstar, 7.48959e-5,2)
-        self.assertAlmostEquals(v, 0.005644689, 1)
-        self.assertAlmostEquals(s , 941.7452, 3)
+        self.assertAlmostEqual(qstar, 7.48959e-5,2)
+        self.assertAlmostEqual(v, 0.005644689, 1)
+        self.assertAlmostEqual(s , 941.7452, 3)
 
     def test_use_case_3(self):
@@ -190,7 +190,7 @@
 
         # Test results
-        self.assertAlmostEquals(qstar, 7.49e-5, 1)
-        self.assertAlmostEquals(v, 0.005648401, 4)
-        self.assertAlmostEquals(s , 941.7452, 3)
+        self.assertAlmostEqual(qstar, 7.49e-5, 1)
+        self.assertAlmostEqual(v, 0.005648401, 4)
+        self.assertAlmostEqual(s , 941.7452, 3)
 
     def test_use_case_4(self):
@@ -218,7 +218,7 @@
 
         # Test results
-        self.assertAlmostEquals(qstar, 7.49e-5,2)
-        self.assertAlmostEquals(v, 0.005952674, 3)
-        self.assertAlmostEquals(s , 941.7452, 3)
+        self.assertAlmostEqual(qstar, 7.49e-5,2)
+        self.assertAlmostEqual(v, 0.005952674, 3)
+        self.assertAlmostEqual(s , 941.7452, 3)
 
     def test_use_case_5(self):
@@ -247,7 +247,7 @@
 
         # Test results
-        self.assertAlmostEquals(qstar, 7.88981e-5,2)
-        self.assertAlmostEquals(v, 0.005952674, 3)
-        self.assertAlmostEquals(s , 941.7452, 3)
+        self.assertAlmostEqual(qstar, 7.88981e-5,2)
+        self.assertAlmostEqual(v, 0.005952674, 3)
+        self.assertAlmostEqual(s , 941.7452, 3)
 
     def test_use_case_6(self):
@@ -273,7 +273,7 @@
 
         # Test results
-        self.assertAlmostEquals(qstar, 7.49e-5,2)
-        self.assertAlmostEquals(v, 0.005952674, 3)
-        self.assertAlmostEquals(s , 941.7452, 3)
+        self.assertAlmostEqual(qstar, 7.49e-5,2)
+        self.assertAlmostEqual(v, 0.005952674, 3)
+        self.assertAlmostEqual(s , 941.7452, 3)
 
 
@@ -297,7 +297,7 @@
         s = inv.get_surface(contrast=2.6e-6, porod_const=2)
         # Test results
-        self.assertAlmostEquals(qstar, 1.361677e-3, 4)
-        self.assertAlmostEquals(v, 0.115352622, 2)
-        self.assertAlmostEquals(s , 941.7452, 3 )
+        self.assertAlmostEqual(qstar, 1.361677e-3, 4)
+        self.assertAlmostEqual(v, 0.115352622, 2)
+        self.assertAlmostEqual(s , 941.7452, 3 )
 
     def test_use_case_2(self):
@@ -315,7 +315,7 @@
         s, ds = inv.get_surface_with_error(contrast=2.6e-6, porod_const=2)
         # Test results
-        self.assertAlmostEquals(qstar, 1.361677e-3, 4)
-        self.assertAlmostEquals(v, 0.115352622, 2)
-        self.assertAlmostEquals(s , 941.7452, 3 )
+        self.assertAlmostEqual(qstar, 1.361677e-3, 4)
+        self.assertAlmostEqual(v, 0.115352622, 2)
+        self.assertAlmostEqual(s , 941.7452, 3 )
 
     def test_use_case_3(self):
@@ -336,7 +336,7 @@
 
         # Test results
-        self.assertAlmostEquals(qstar, 0.00138756,2)
-        self.assertAlmostEquals(v, 0.117226896,2)
-        self.assertAlmostEquals(s ,941.7452, 3)
+        self.assertAlmostEqual(qstar, 0.00138756,2)
+        self.assertAlmostEqual(v, 0.117226896,2)
+        self.assertAlmostEqual(s ,941.7452, 3)
 
     def test_use_case_4(self):
@@ -354,5 +354,5 @@
 
         # Test results
-        self.assertAlmostEquals(qstar, 0.0045773,2)
+        self.assertAlmostEqual(qstar, 0.0045773,2)
 
     def test_use_case_5(self):
@@ -374,5 +374,5 @@
 
         # Test results
-        self.assertAlmostEquals(qstar, 0.00460319,3)
+        self.assertAlmostEqual(qstar, 0.00460319,3)
       
   
Index: test/sasrealspace/test/utest_oriented.py
===================================================================
--- test/sasrealspace/test/utest_oriented.py	(revision 1cdbcd86f80ac59e1681b673122c51157177496f)
+++ test/sasrealspace/test/utest_oriented.py	(revision 88d2e70bb28d8f9c855c86d94ad8ddd63154277b)
@@ -59,5 +59,5 @@
         ana_val = self.ana.runXY([0.1, 0.1])
         sim_val = self.model.getIq2D(0.1, 0.1)
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.1 )
+        self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.1 )
 
 class TestCylinderAddObject(unittest.TestCase):
@@ -101,5 +101,5 @@
         #print ana_val, sim_val, sim_val/ana_val
 
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+        self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
 
 
@@ -143,5 +143,5 @@
         #print ana_val, sim_val, sim_val/ana_val
 
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+        self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
 
     def testalongZ(self):
@@ -156,5 +156,5 @@
         #print ana_val, sim_val, sim_val/ana_val
 
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+        self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
 
     def testalongX(self):
@@ -169,5 +169,5 @@
         #print ana_val, sim_val, sim_val/ana_val
 
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+        self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
 
 class TestEllipsoid(unittest.TestCase):
@@ -213,5 +213,5 @@
         #print ana_val, sim_val, sim_val/ana_val
 
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+        self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
 
     def testalongZ(self):
@@ -226,5 +226,5 @@
         #print ana_val, sim_val, sim_val/ana_val
 
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+        self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
 
     def testalongY(self):
@@ -240,5 +240,5 @@
 
         try:
-            self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+            self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
         except Exception:
             print("Error", ana_val, sim_val, sim_val/ana_val)
@@ -295,5 +295,5 @@
         sim_val, err = self.canvas.getIq2DError(0.1, 0.2)
 
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+        self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
 
 class TestCoreShellError(unittest.TestCase):
@@ -347,5 +347,5 @@
         sim_val, err = self.canvas.getIq2DError(0.1, 0.2)
 
-        self.assert_( math.fabs(sim_val-ana_val) < 3.0 * err )
+        self.assertTrue( math.fabs(sim_val-ana_val) < 3.0 * err )
 
 class TestRunMethods(unittest.TestCase):
@@ -392,5 +392,5 @@
 
         try:
-            self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+            self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
         except Exception:
             print("Error", ana_val, sim_val, sim_val/ana_val)
@@ -404,5 +404,5 @@
 
         try:
-            self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+            self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
         except Exception:
             print("Error", ana_val, sim_val, sim_val/ana_val)
@@ -416,5 +416,5 @@
 
         try:
-            self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+            self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
         except Exception:
             print("Error", ana_val, sim_val, sim_val/ana_val)
@@ -428,5 +428,5 @@
 
         try:
-            self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+            self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
         except Exception:
             print("Error", ana_val, sim_val, sim_val/ana_val)
@@ -471,5 +471,5 @@
         sim_val = self.model.getIq2D(0.1, 0.2)
 
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+        self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
 
         # Change the radius a re-evaluate
@@ -479,5 +479,5 @@
         ana_val = self.ana.runXY([0.1, 0.2])
         sim_val = self.model.getIq2D(0.1, 0.2)
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+        self.assertTrue( math.fabs(sim_val/ana_val-1.0)<0.05 )
 
 
Index: test/sasrealspace/test/utest_realspace.py
===================================================================
--- test/sasrealspace/test/utest_realspace.py	(revision 1cdbcd86f80ac59e1681b673122c51157177496f)
+++ test/sasrealspace/test/utest_realspace.py	(revision 88d2e70bb28d8f9c855c86d94ad8ddd63154277b)
@@ -38,5 +38,5 @@
         self.model.add('ellipsoid','elli2')
         self.model.delete('elli2')
-        self.assert_('elli2' not in self.model.getShapeList())
+        self.assertTrue('elli2' not in self.model.getShapeList())
 
     def testsetParam(self):
@@ -81,5 +81,5 @@
         value_2 = self.canvas.getIq(0.001)
 
-        self.assert_( (value_1-value_2)/value_1 < 0.1)
+        self.assertTrue( (value_1-value_2)/value_1 < 0.1)
 
     def testSetDensityTiming(self):
@@ -99,9 +99,9 @@
         t_2 = time.time()-t_0
 
-        self.assert_( t_2 < t_1 and (t_1-t_2)/t_2 > 2)
+        self.assertTrue( t_2 < t_1 and (t_1-t_2)/t_2 > 2)
 
     def testGetParamList(self):
         """ Test GetParamList on empty canvas"""
-        self.assert_('lores_density' in self.canvas.getParamList())
+        self.assertTrue('lores_density' in self.canvas.getParamList())
         handle = self.canvas.add('sphere')
 
@@ -109,5 +109,5 @@
         """ Test GetParamList on filled canvas"""
         self.canvas.add('sphere')
-        self.assert_('lores_density' in self.canvas.getParamList())
+        self.assertTrue('lores_density' in self.canvas.getParamList())
 
     def testAdd(self):
@@ -151,8 +151,8 @@
         # THIS WILL DEPEND ON THE NUMBER OF SPACE POINTS:
         # that why we need some error analysis.
-        self.assert_( (sim_2*ana_1/sim_1 - ana_2)/ana_2 < 0.1)
+        self.assertTrue( (sim_2*ana_1/sim_1 - ana_2)/ana_2 < 0.1)
 
         # test the absolute amplitude
-        self.assert_( math.fabs(sim_2-ana_2)/ana_2 < 0.1)
+        self.assertTrue( math.fabs(sim_2-ana_2)/ana_2 < 0.1)
 
     def testGetIq2(self):
@@ -196,5 +196,5 @@
         sim_2 = self.canvas.getIq(0.01)
 
-        self.assert_((sim_2-sim_1)/sim_1<0.05)
+        self.assertTrue((sim_2-sim_1)/sim_1<0.05)
 
     def testGetIq_time(self):
@@ -216,5 +216,5 @@
         delta_2 = time.time()-t_0
 
-        self.assert_((delta_2-delta_1)/delta_1<0.05)
+        self.assertTrue((delta_2-delta_1)/delta_1<0.05)
 
 
@@ -342,5 +342,5 @@
         ana = self.sphere.run(0.05)
         val, err = self.canvas.getIqError(0.05)
-        self.assert_(math.fabs(ana-val)<2.0*err)
+        self.assertTrue(math.fabs(ana-val)<2.0*err)
 
     def testRightOrder(self):
@@ -350,5 +350,5 @@
         val, err = self.canvas.getIqError(0.05)
         #print 'right', ana, val, err
-        self.assert_(math.fabs(ana-val)/ana < 1.1)
+        self.assertTrue(math.fabs(ana-val)/ana < 1.1)
 
     def testWrongOrder(self):
@@ -365,5 +365,5 @@
         val, err = self.canvas.getIqError(0.05)
         #print 'wrong', ana, val, err
-        self.assert_(math.fabs(ana-val)/ana < 1.1)
+        self.assertTrue(math.fabs(ana-val)/ana < 1.1)
 
 
