Commit 54f2c5bf authored by Daniel Brown's avatar Daniel Brown
Browse files

making test scripts raise exception on warning

parent def5b19e
Pipeline #1773 passed with stage
in 19 seconds
......@@ -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)
......
......@@ -2,6 +2,9 @@ import pykat
import traceback
import os
import sys
import warnings
warnings.filterwarnings('error')
class bcolors:
HEADER = '\033[95m'
......
......@@ -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"))
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment