File close operation using invalid file object
Suppose to use the file object for the the close method.
Found during testing and have corrected it.
Change-Id: I9d80dda6b6211cbeec7740f2a951eef765f9761e
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tools/oem/ibm/gen_csv_results.py b/tools/oem/ibm/gen_csv_results.py
index 5ecb853..f3174f4 100755
--- a/tools/oem/ibm/gen_csv_results.py
+++ b/tools/oem/ibm/gen_csv_results.py
@@ -63,10 +63,6 @@
print "Writing data into csv file:", l_csvfile
for testcase in collectDataObj.testData:
- with open(l_csvfile, "w") as output:
- writer = csv.writer(output, lineterminator='\n')
- writer.writerows(l_csvlist)
-
# Test category : Test case type
l_test_name = str(testcase.parent) + ":" + str(testcase)
@@ -82,7 +78,11 @@
l_test_type, l_test_result, l_test_name, l_pse_rel]
l_csvlist.append(l_data)
- l_csvlist.close()
+ # Open the file and write to the CSV file
+ l_file = open(l_csvfile, "w")
+ l_writer = csv.writer(l_file, lineterminator='\n')
+ l_writer.writerows(l_csvlist)
+ l_file.close()
def usage():