The error occurred in the GCP test test_gcp_create_report_without_write_monthly whenever it was executed on the first day of the month. This happened because a list was generated with a filename for each month. Consequently, when the range "last day of month X" to "first day of month Y" was processed, the list was populated with a file for month X and another for month Y. However, in a testing scenario, the report name was always test_report.csv, resulting in a list with this value repeated twice. Therefore, an attempt to delete the file was made twice, causing an error on the second attempt since it had already been deleted the first time.
This change ensures that if the csv file has the same name, it will be added to the list only once. This prevents a second (or nth) deletion attempt.
How to test?
Checkout branch
Adapt the test_gcp_create_report_without_write_monthly test (test_report.py) adding the following lines to force a test with different dates:
The error occurred in the GCP test
test_gcp_create_report_without_write_monthly
whenever it was executed on the first day of the month. This happened because a list was generated with a filename for each month. Consequently, when the range "last day of month X" to "first day of month Y" was processed, the list was populated with a file for month X and another for month Y. However, in a testing scenario, the report name was alwaystest_report.csv
, resulting in a list with this value repeated twice. Therefore, an attempt to delete the file was made twice, causing an error on the second attempt since it had already been deleted the first time.This change ensures that if the csv file has the same name, it will be added to the list only once. This prevents a second (or nth) deletion attempt.
How to test?
test_gcp_create_report_without_write_monthly
test (test_report.py) adding the following lines to force a test with different dates:python3 -m unittest tests.test_report
orpython3 -m unittest tests.test_report.GCPReportTestCase