I am trying to use AUnit for Unit testing in apama. So I checked and read tha Aunit package uses Apama Pysys in the backend to test Apama application.
While I was successful in building the Aunit package , I am getting an error in testing the sample Apama monitors given with it. I am continuously getting the Warning:
c:\aunit-master\bin>aunit test Math
Copying C:\aunit-master\workspace\Math/src/Float.mon to C:\aunit-master\.__test\resources\Float.mon
2019-02-26 13:18:30,296 INFO ==============================================================
2019-02-26 13:18:30,300 INFO Id : MathFloatTest
2019-02-26 13:18:30,302 INFO Title: MathFloatTest
2019-02-26 13:18:30,304 INFO ==============================================================
2019-02-26 13:18:33,068 WARN caught <class '_csv.Error'> while running test: iterator should return strings, not bytes (did you open the file in text mode?)
Traceback (most recent call last):
File "C:\SoftwareAG2\Apama\third_party\python\Lib\site-packages\pysys\baserunner.py", line 561, in __call__
self.testObj.validate()
File "C:\aunit-master\.__test\MathFloatTest\run.py", line 27, in validate
for row in reader:
_csv.Error: iterator should return strings, not bytes (did you open the file in text mode?)
2019-02-26 13:18:33,299 WARN iterator should return strings, not bytes (did you open the file in text mode?) (<class '_csv.Error'>) ... blocked
2019-02-26 13:18:36,196 WARN caught <class '_csv.Error'> while running test: iterator should return strings, not bytes (did you open the file in text mode?)
Traceback (most recent call last):
File "C:\SoftwareAG2\Apama\third_party\python\Lib\site-packages\pysys\baserunner.py", line 561, in __call__
self.testObj.validate()
File "C:\aunit-master\.__test\MathIntegerTest\run.py", line 27, in validate
for row in reader:
_csv.Error: iterator should return strings, not bytes (did you open the file in text mode?)
2019-02-26 13:18:36,203 WARN iterator should return strings, not bytes (did you open the file in text mode?) (<class '_csv.Error'>) ... blocked
2019-02-26 13:18:36,328 CRIT
2019-02-26 13:18:36,329 CRIT Completed test run at: Tuesday 2019-02-26 13:18:36 W. Europe Standard Time
2019-02-26 13:18:36,330 CRIT Total test duration: 6.04 secs
2019-02-26 13:18:36,330 CRIT
2019-02-26 13:18:36,331 CRIT Summary of non passes:
2019-02-26 13:18:36,331 CRIT BLOCKED: MathFloatTest
2019-02-26 13:18:36,332 CRIT BLOCKED: MathIntegerTest
And this warning gives the results of the testcase as BLOCKED.
Without any code to look at and understand what you are doing, it looks to me like either the file being read (the csv) is in an unexpected encoding.
If you are opening the file at some point you need to make sure that it is read with the correct encoding or opened as a text file (I used utf8 below but if that doesn't work you may need to work out what encoding it is.
If you are not opening the file, and the open is happening within the library, then it could still be a bad encoding of what is being read - perhaps the data should be utf8 but it's some windows format?
you'll need to add code to the question so we can examine what is going on properly however if neither of these solves the issue.