diff --git a/Pipfile.lock b/Pipfile.lock index fd1b9c75..bc334a0c 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -58,11 +58,12 @@ }, "certifi": { "hashes": [ - "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f", - "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1" + "sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b", + "sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90" ], + "index": "pypi", "markers": "python_version >= '3.6'", - "version": "==2024.2.2" + "version": "==2024.7.4" }, "cffi": { "hashes": [ @@ -856,12 +857,12 @@ }, "urllib3": { "hashes": [ - "sha256:34b97092d7e0a3a8cf7cd10e386f401b3737364026c45e622aa02903dffe0f07", - "sha256:f8ecc1bba5667413457c529ab955bf8c67b45db799d159066261719e328580a0" + "sha256:37a0344459b199fce0e80b0d3569837ec6b6937435c5244e7fd73fa6006830f3", + "sha256:3e3d753a8618b86d7de333b4223005f68720bcd6a7d2bcb9fbd2229ec7c1e429" ], "index": "pypi", "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", - "version": "==1.26.18" + "version": "==1.26.19" } }, "develop": { diff --git a/nise/__init__.py b/nise/__init__.py index 6d8c101e..511a7465 100644 --- a/nise/__init__.py +++ b/nise/__init__.py @@ -1,3 +1,3 @@ -__version__ = "4.5.6" +__version__ = "4.5.7" VERSION = __version__.split(".") diff --git a/nise/report.py b/nise/report.py index de68ffd5..c48f5ebd 100644 --- a/nise/report.py +++ b/nise/report.py @@ -1187,7 +1187,8 @@ def gcp_create_report(options): # noqa: C901 local_file_path, output_file_name = write_gcp_file(gen_start_date, gen_end_date, data, options) output_files.append(output_file_name) - monthly_files.append(local_file_path) + if local_file_path not in monthly_files: + monthly_files.append(local_file_path) for index, month_file in enumerate(monthly_files): if gcp_bucket_name: diff --git a/tests/test_report.py b/tests/test_report.py index 0bd419d9..d3b60407 100644 --- a/tests/test_report.py +++ b/tests/test_report.py @@ -1627,6 +1627,24 @@ def test_gcp_create_report_without_write_monthly(self): self.assertFalse(os.path.isfile(expected_output_file_path)) + def test_gcp_create_report_without_write_monthly_overlapping_month(self): + """Test that there are no Exceptions when processing overlapping months dates.""" + now = datetime.datetime(2024, 7, 1, 0, 0) + yesterday = datetime.datetime(2024, 6, 30, 0, 0) + report_prefix = "test_report" + options = { + "start_date": yesterday, + "end_date": now, + "gcp_report_prefix": report_prefix, + "gcp_bucket_name": "gcp_bucket_name", + } + fix_dates(options, "gcp") + gcp_create_report(options) + output_file_name = "{}-{}.csv".format(report_prefix, yesterday.strftime("%Y-%m-%d")) + expected_output_file_path = "{}/{}".format(os.getcwd(), output_file_name) + + self.assertFalse(os.path.isfile(expected_output_file_path)) + def test_gcp_create_report_with_dataset_name_static_data(self): """Test the gcp report creation method where a dataset name is included and static data used.""" now = datetime.datetime.now().replace(microsecond=0, second=0, minute=0, hour=0)