From 54f2c5bf425fd7cfa25a9d02b94fc1fa46c7b7d7 Mon Sep 17 00:00:00 2001
From: Daniel Brown <ddb@star.sr.bham.ac.uk>
Date: Mon, 9 Jan 2017 22:20:10 +0000
Subject: [PATCH] making test scripts raise exception on warning

---
 pykat/finesse.py                                            | 3 ++-
 test/run_tests.py                                           | 3 +++
 test/test_scripts/structural/test_deepcopying_references.py | 2 +-
 test/test_scripts/structural/test_lambda0_beam_param.py     | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/pykat/finesse.py b/pykat/finesse.py
index e0eaf27..a524485 100644
--- a/pykat/finesse.py
+++ b/pykat/finesse.py
@@ -878,6 +878,7 @@ class kat(object):
         self.__time_code = None
         self.__yaxis = "abs" # default yaxis
         self.__lambda0 = 1064e-9
+        self.__finesse_dir = None
         
         if kat_code != None and kat_file != None:
             raise pkex.BasePyKatException("Specify either a Kat file or some Kat code, not both.")
@@ -895,7 +896,7 @@ class kat(object):
         
     def __setattr__(self, name, value):
         if "____FROZEN____" in self.__dict__ and self.__dict__["____FROZEN____"] and not hasattr(self, name):
-            warnings.warn("'%s' does not have attribute called '%s'" % (self.__name, name), stacklevel=2)
+            warnings.warn("'%s' does not have attribute called '%s'" % (self.__class__.__name__, name), stacklevel=2)
 
         super(kat, self).__setattr__(name, value)
         
diff --git a/test/run_tests.py b/test/run_tests.py
index ffa3705..f89a89f 100644
--- a/test/run_tests.py
+++ b/test/run_tests.py
@@ -2,6 +2,9 @@ import pykat
 import traceback
 import os
 import sys
+import warnings
+
+warnings.filterwarnings('error')
 
 class bcolors:
     HEADER = '\033[95m'
diff --git a/test/test_scripts/structural/test_deepcopying_references.py b/test/test_scripts/structural/test_deepcopying_references.py
index 2d3fc7f..99342ff 100644
--- a/test/test_scripts/structural/test_deepcopying_references.py
+++ b/test/test_scripts/structural/test_deepcopying_references.py
@@ -44,7 +44,7 @@ kat1.o1.num_demods = 2
 assert(hasattr(kat1.o1, "f2"))
 assert(not hasattr(kat0.o1, "f2"))
 
-kat1.num_demods = 1
+kat1.o1.num_demods = 1
 
 assert(hasattr(kat1.o1, "f1"))
 
diff --git a/test/test_scripts/structural/test_lambda0_beam_param.py b/test/test_scripts/structural/test_lambda0_beam_param.py
index ac78e97..83010b8 100644
--- a/test/test_scripts/structural/test_lambda0_beam_param.py
+++ b/test/test_scripts/structural/test_lambda0_beam_param.py
@@ -26,7 +26,7 @@ yaxis abs:deg                                 # move detector frequency with xax
 kat = finesse.kat()
 kat.verbose = False
 kat.lambda0 = 1550e-9
-kat.parseKatCode(kat_code)
+kat.parseCommands(kat_code)
 kat.maxtem = 0
 kat.trace = 2
 out, T = kat.run(getTraceData=True)
-- 
GitLab