From abdedf30780622d3d521968b9ea9a15a821e06ae Mon Sep 17 00:00:00 2001 From: Tara Lakdawala Date: Wed, 30 Jun 2021 17:04:27 -0400 Subject: [PATCH 01/12] changed warning to info --- src/acquisition/covidcast/csv_importer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acquisition/covidcast/csv_importer.py b/src/acquisition/covidcast/csv_importer.py index 55ec847cc..b7b9cbcfb 100644 --- a/src/acquisition/covidcast/csv_importer.py +++ b/src/acquisition/covidcast/csv_importer.py @@ -95,7 +95,7 @@ def find_issue_specific_csv_files(scan_dir, glob=glob): logger.info('processing csv files from issue date: "' + str(issue_date) + '", directory', path) yield from CsvImporter.find_csv_files(path, issue=(issue_date, epi.Week.fromdate(issue_date)), glob=glob) else: - logger.warning(event='invalid issue directory day', detail=issue_date_value, file=path) + logger.info('invalid issue directory day', issue_date_value) @staticmethod def find_csv_files(scan_dir, issue=(date.today(), epi.Week.fromdate(date.today())), glob=glob): From 9682035c9caddd01778c27221bd1cda52277cfd8 Mon Sep 17 00:00:00 2001 From: Tara Lakdawala Date: Wed, 30 Jun 2021 17:21:57 -0400 Subject: [PATCH 02/12] changed line 98 to warning, removed excess args --- src/acquisition/covidcast/csv_importer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acquisition/covidcast/csv_importer.py b/src/acquisition/covidcast/csv_importer.py index b7b9cbcfb..9182dfdc2 100644 --- a/src/acquisition/covidcast/csv_importer.py +++ b/src/acquisition/covidcast/csv_importer.py @@ -95,7 +95,7 @@ def find_issue_specific_csv_files(scan_dir, glob=glob): logger.info('processing csv files from issue date: "' + str(issue_date) + '", directory', path) yield from CsvImporter.find_csv_files(path, issue=(issue_date, epi.Week.fromdate(issue_date)), glob=glob) else: - logger.info('invalid issue directory day', issue_date_value) + logger.warning('invalid issue directory day', issue_date_value) @staticmethod def find_csv_files(scan_dir, issue=(date.today(), epi.Week.fromdate(date.today())), glob=glob): From 9a67650a0efc1f7b20165ca33eec5c4ce74bfb83 Mon Sep 17 00:00:00 2001 From: Tara Lakdawala Date: Wed, 30 Jun 2021 17:35:59 -0400 Subject: [PATCH 03/12] changed warning back to info so it doesn't fail the build --- src/acquisition/covidcast/csv_importer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acquisition/covidcast/csv_importer.py b/src/acquisition/covidcast/csv_importer.py index 9182dfdc2..b7b9cbcfb 100644 --- a/src/acquisition/covidcast/csv_importer.py +++ b/src/acquisition/covidcast/csv_importer.py @@ -95,7 +95,7 @@ def find_issue_specific_csv_files(scan_dir, glob=glob): logger.info('processing csv files from issue date: "' + str(issue_date) + '", directory', path) yield from CsvImporter.find_csv_files(path, issue=(issue_date, epi.Week.fromdate(issue_date)), glob=glob) else: - logger.warning('invalid issue directory day', issue_date_value) + logger.info('invalid issue directory day', issue_date_value) @staticmethod def find_csv_files(scan_dir, issue=(date.today(), epi.Week.fromdate(date.today())), glob=glob): From 7b36cb4ee163d5eec7697c25cfd1d3288c406069 Mon Sep 17 00:00:00 2001 From: Tara Lakdawala Date: Thu, 1 Jul 2021 12:02:55 -0400 Subject: [PATCH 04/12] update line 95 to use correct args --- src/acquisition/covidcast/csv_importer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acquisition/covidcast/csv_importer.py b/src/acquisition/covidcast/csv_importer.py index b7b9cbcfb..8c3167964 100644 --- a/src/acquisition/covidcast/csv_importer.py +++ b/src/acquisition/covidcast/csv_importer.py @@ -92,7 +92,7 @@ def find_issue_specific_csv_files(scan_dir, glob=glob): issue_date_value = int(issuedir_match.group(2)) issue_date = CsvImporter.is_sane_day(issue_date_value) if issue_date: - logger.info('processing csv files from issue date: "' + str(issue_date) + '", directory', path) + logger.info('processing csv files from issue date', issue_date_value) yield from CsvImporter.find_csv_files(path, issue=(issue_date, epi.Week.fromdate(issue_date)), glob=glob) else: logger.info('invalid issue directory day', issue_date_value) From e521551cd9dd6fee1652ad241efd5e950dfc683d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=84=B6=E7=84=B6?= <52230092+zhuoran-cheng@users.noreply.github.com> Date: Thu, 1 Jul 2021 17:52:13 -0400 Subject: [PATCH 05/12] change to structure logging --- src/acquisition/covidcast/csv_importer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/acquisition/covidcast/csv_importer.py b/src/acquisition/covidcast/csv_importer.py index 8c3167964..fd44b94c2 100644 --- a/src/acquisition/covidcast/csv_importer.py +++ b/src/acquisition/covidcast/csv_importer.py @@ -92,10 +92,10 @@ def find_issue_specific_csv_files(scan_dir, glob=glob): issue_date_value = int(issuedir_match.group(2)) issue_date = CsvImporter.is_sane_day(issue_date_value) if issue_date: - logger.info('processing csv files from issue date', issue_date_value) + logger.info(event='processing csv files from issue', detail=issue_date, file=path) yield from CsvImporter.find_csv_files(path, issue=(issue_date, epi.Week.fromdate(issue_date)), glob=glob) else: - logger.info('invalid issue directory day', issue_date_value) + logger.info(event='invalid issue directory day', detail=issue_date_value, file=path) @staticmethod def find_csv_files(scan_dir, issue=(date.today(), epi.Week.fromdate(date.today())), glob=glob): From c8c32954af3794bd4dceab779a35316360fde547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=84=B6=E7=84=B6?= <52230092+zhuoran-cheng@users.noreply.github.com> Date: Fri, 2 Jul 2021 14:06:40 -0400 Subject: [PATCH 06/12] change info back to warning wih structure logging --- src/acquisition/covidcast/csv_importer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acquisition/covidcast/csv_importer.py b/src/acquisition/covidcast/csv_importer.py index fd44b94c2..f55327d85 100644 --- a/src/acquisition/covidcast/csv_importer.py +++ b/src/acquisition/covidcast/csv_importer.py @@ -95,7 +95,7 @@ def find_issue_specific_csv_files(scan_dir, glob=glob): logger.info(event='processing csv files from issue', detail=issue_date, file=path) yield from CsvImporter.find_csv_files(path, issue=(issue_date, epi.Week.fromdate(issue_date)), glob=glob) else: - logger.info(event='invalid issue directory day', detail=issue_date_value, file=path) + logger.warning(event='invalid issue directory day', detail=issue_date_value, file=path) @staticmethod def find_csv_files(scan_dir, issue=(date.today(), epi.Week.fromdate(date.today())), glob=glob): From 80289598b52c8b7a83fa6203dbbbb1ea48229ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=84=B6=E7=84=B6?= <52230092+zhuoran-cheng@users.noreply.github.com> Date: Fri, 2 Jul 2021 16:41:35 -0400 Subject: [PATCH 07/12] add the test (failed approach, cannot get exception) --- .../covidcast/test_csv_importer.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/acquisition/covidcast/test_csv_importer.py b/tests/acquisition/covidcast/test_csv_importer.py index 963224ef0..69f5e21c5 100644 --- a/tests/acquisition/covidcast/test_csv_importer.py +++ b/tests/acquisition/covidcast/test_csv_importer.py @@ -41,6 +41,27 @@ def test_is_sane_week(self): self.assertFalse(CsvImporter.is_sane_week(202000)) self.assertFalse(CsvImporter.is_sane_week(202054)) self.assertFalse(CsvImporter.is_sane_week(20200418)) + + def test_find_issue_specific_csv_files(self): + """Recursively explore and find issue specific CSV files.""" + + path_prefix='prefix/to/the/data/' + #valid day path + glob_paths = [path_prefix +'/archive/failed/src-name/issue_20200408'] + issue_path='/archive/failed/src-name/issue_20200408' + mock_glob = MagicMock() + mock_glob.glob.return_value = glob_paths + issuedir_match = CsvImporter.PATTERN_ISSUE_DIR.match(issue_path.lower()) + issue_date_value = int(issuedir_match.group(2)) + + #check if the day is a valid issue day. + self.assertTrue(CsvImporter.is_sane_day(issue_date_value)) + + with self.assertRaises(Exception): + CsvImporter.find_issue_specific_csv_files(path_prefix, glob=mock_glob) + + + def test_find_csv_files(self): """Recursively explore and find CSV files.""" From 69852673fba764e0b887e5833fff48aa00174212 Mon Sep 17 00:00:00 2001 From: Kathryn M Mazaitis Date: Tue, 6 Jul 2021 12:36:15 -0400 Subject: [PATCH 08/12] test first, then fix --- src/acquisition/covidcast/csv_importer.py | 2 +- .../acquisition/covidcast/test_csv_importer.py | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/acquisition/covidcast/csv_importer.py b/src/acquisition/covidcast/csv_importer.py index f55327d85..df47b1530 100644 --- a/src/acquisition/covidcast/csv_importer.py +++ b/src/acquisition/covidcast/csv_importer.py @@ -92,7 +92,7 @@ def find_issue_specific_csv_files(scan_dir, glob=glob): issue_date_value = int(issuedir_match.group(2)) issue_date = CsvImporter.is_sane_day(issue_date_value) if issue_date: - logger.info(event='processing csv files from issue', detail=issue_date, file=path) + logger.info(event='processing csv files from issue', detail=issue_date, path) yield from CsvImporter.find_csv_files(path, issue=(issue_date, epi.Week.fromdate(issue_date)), glob=glob) else: logger.warning(event='invalid issue directory day', detail=issue_date_value, file=path) diff --git a/tests/acquisition/covidcast/test_csv_importer.py b/tests/acquisition/covidcast/test_csv_importer.py index 69f5e21c5..139bc70a0 100644 --- a/tests/acquisition/covidcast/test_csv_importer.py +++ b/tests/acquisition/covidcast/test_csv_importer.py @@ -47,21 +47,19 @@ def test_find_issue_specific_csv_files(self): path_prefix='prefix/to/the/data/' #valid day path - glob_paths = [path_prefix +'/archive/failed/src-name/issue_20200408'] - issue_path='/archive/failed/src-name/issue_20200408' + issue_path='issue_20200408' + glob_issue_path = path_prefix + issue_path + glob_file_path = path_prefix + issue_path + '/valid/20200408_nation_sig.csv' mock_glob = MagicMock() - mock_glob.glob.return_value = glob_paths - issuedir_match = CsvImporter.PATTERN_ISSUE_DIR.match(issue_path.lower()) + mock_glob.glob.side_effect = ([glob_issue_path], [glob_file_path]) + issuedir_match = CsvImporter.PATTERN_ISSUE_DIR.match(glob_issue_path.lower()) issue_date_value = int(issuedir_match.group(2)) #check if the day is a valid issue day. self.assertTrue(CsvImporter.is_sane_day(issue_date_value)) - with self.assertRaises(Exception): - CsvImporter.find_issue_specific_csv_files(path_prefix, glob=mock_glob) - - - + found = set(CsvImporter.find_issue_specific_csv_files(path_prefix, glob=mock_glob)) + self.assertTrue(len(found)>0) def test_find_csv_files(self): """Recursively explore and find CSV files.""" @@ -327,4 +325,4 @@ def test_load_csv_with_valid_header(self): self.assertEqual(rows[2].missing_stderr, Nans.NOT_MISSING) self.assertEqual(rows[2].missing_sample_size, Nans.REGION_EXCEPTION) - self.assertIsNone(rows[3]) \ No newline at end of file + self.assertIsNone(rows[3]) From bfb15a72b5e0033563e852e17172eb56f0439de4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=84=B6=E7=84=B6?= <52230092+zhuoran-cheng@users.noreply.github.com> Date: Tue, 6 Jul 2021 19:02:21 -0400 Subject: [PATCH 09/12] modified the bad code at function find_issue_specific_csv_files and add test --- src/acquisition/covidcast/csv_importer.py | 4 ++-- tests/acquisition/covidcast/test_csv_importer.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/acquisition/covidcast/csv_importer.py b/src/acquisition/covidcast/csv_importer.py index df47b1530..df9f87573 100644 --- a/src/acquisition/covidcast/csv_importer.py +++ b/src/acquisition/covidcast/csv_importer.py @@ -88,11 +88,11 @@ def find_issue_specific_csv_files(scan_dir, glob=glob): logger = get_structured_logger('find_issue_specific_csv_files') for path in sorted(glob.glob(os.path.join(scan_dir, '*'))): issuedir_match = CsvImporter.PATTERN_ISSUE_DIR.match(path.lower()) - if issuedir_match and os.path.isdir(path): + if issuedir_match and glob.glob(os.path.isdir(path)): issue_date_value = int(issuedir_match.group(2)) issue_date = CsvImporter.is_sane_day(issue_date_value) if issue_date: - logger.info(event='processing csv files from issue', detail=issue_date, path) + logger.info(event='processing csv files from issue', detail=issue_date, file=path) yield from CsvImporter.find_csv_files(path, issue=(issue_date, epi.Week.fromdate(issue_date)), glob=glob) else: logger.warning(event='invalid issue directory day', detail=issue_date_value, file=path) diff --git a/tests/acquisition/covidcast/test_csv_importer.py b/tests/acquisition/covidcast/test_csv_importer.py index 139bc70a0..f9ba7f0be 100644 --- a/tests/acquisition/covidcast/test_csv_importer.py +++ b/tests/acquisition/covidcast/test_csv_importer.py @@ -41,23 +41,23 @@ def test_is_sane_week(self): self.assertFalse(CsvImporter.is_sane_week(202000)) self.assertFalse(CsvImporter.is_sane_week(202054)) self.assertFalse(CsvImporter.is_sane_week(20200418)) - + def test_find_issue_specific_csv_files(self): """Recursively explore and find issue specific CSV files.""" - path_prefix='prefix/to/the/data/' #valid day path issue_path='issue_20200408' glob_issue_path = path_prefix + issue_path - glob_file_path = path_prefix + issue_path + '/valid/20200408_nation_sig.csv' + glob_file_path = path_prefix + issue_path + '/ght/20200408_state_rawsearch.csv' mock_glob = MagicMock() - mock_glob.glob.side_effect = ([glob_issue_path], [glob_file_path]) - issuedir_match = CsvImporter.PATTERN_ISSUE_DIR.match(glob_issue_path.lower()) - issue_date_value = int(issuedir_match.group(2)) + mock_glob.glob.side_effect = ([glob_issue_path], [glob_file_path], [glob_file_path]) #check if the day is a valid issue day. + issuedir_match = CsvImporter.PATTERN_ISSUE_DIR.match(glob_issue_path.lower()) + issue_date_value = int(issuedir_match.group(2)) + self.assertTrue(CsvImporter.is_sane_day(issue_date_value)) - + found = set(CsvImporter.find_issue_specific_csv_files(path_prefix, glob=mock_glob)) self.assertTrue(len(found)>0) From 623539ef5fca38dd578457bd01469ce1034accba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=84=B6=E7=84=B6?= <52230092+zhuoran-cheng@users.noreply.github.com> Date: Tue, 6 Jul 2021 19:16:38 -0400 Subject: [PATCH 10/12] delete the check dir, avoid integration test fail --- src/acquisition/covidcast/csv_importer.py | 2 +- tests/acquisition/covidcast/test_csv_importer.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/acquisition/covidcast/csv_importer.py b/src/acquisition/covidcast/csv_importer.py index df9f87573..daae69d0d 100644 --- a/src/acquisition/covidcast/csv_importer.py +++ b/src/acquisition/covidcast/csv_importer.py @@ -88,7 +88,7 @@ def find_issue_specific_csv_files(scan_dir, glob=glob): logger = get_structured_logger('find_issue_specific_csv_files') for path in sorted(glob.glob(os.path.join(scan_dir, '*'))): issuedir_match = CsvImporter.PATTERN_ISSUE_DIR.match(path.lower()) - if issuedir_match and glob.glob(os.path.isdir(path)): + if issuedir_match: issue_date_value = int(issuedir_match.group(2)) issue_date = CsvImporter.is_sane_day(issue_date_value) if issue_date: diff --git a/tests/acquisition/covidcast/test_csv_importer.py b/tests/acquisition/covidcast/test_csv_importer.py index f9ba7f0be..e29773dd0 100644 --- a/tests/acquisition/covidcast/test_csv_importer.py +++ b/tests/acquisition/covidcast/test_csv_importer.py @@ -50,7 +50,7 @@ def test_find_issue_specific_csv_files(self): glob_issue_path = path_prefix + issue_path glob_file_path = path_prefix + issue_path + '/ght/20200408_state_rawsearch.csv' mock_glob = MagicMock() - mock_glob.glob.side_effect = ([glob_issue_path], [glob_file_path], [glob_file_path]) + mock_glob.glob.side_effect = ([glob_issue_path], [glob_file_path]) #check if the day is a valid issue day. issuedir_match = CsvImporter.PATTERN_ISSUE_DIR.match(glob_issue_path.lower()) From cd24e13089e53fbb4e18640df21702ff98900464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=84=B6=E7=84=B6?= <52230092+zhuoran-cheng@users.noreply.github.com> Date: Wed, 7 Jul 2021 15:02:40 -0400 Subject: [PATCH 11/12] add back the path check, add valid/unvalid path check --- src/acquisition/covidcast/csv_importer.py | 2 +- .../covidcast/test_csv_importer.py | 32 ++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/acquisition/covidcast/csv_importer.py b/src/acquisition/covidcast/csv_importer.py index daae69d0d..f55327d85 100644 --- a/src/acquisition/covidcast/csv_importer.py +++ b/src/acquisition/covidcast/csv_importer.py @@ -88,7 +88,7 @@ def find_issue_specific_csv_files(scan_dir, glob=glob): logger = get_structured_logger('find_issue_specific_csv_files') for path in sorted(glob.glob(os.path.join(scan_dir, '*'))): issuedir_match = CsvImporter.PATTERN_ISSUE_DIR.match(path.lower()) - if issuedir_match: + if issuedir_match and os.path.isdir(path): issue_date_value = int(issuedir_match.group(2)) issue_date = CsvImporter.is_sane_day(issue_date_value) if issue_date: diff --git a/tests/acquisition/covidcast/test_csv_importer.py b/tests/acquisition/covidcast/test_csv_importer.py index e29773dd0..d11a67261 100644 --- a/tests/acquisition/covidcast/test_csv_importer.py +++ b/tests/acquisition/covidcast/test_csv_importer.py @@ -6,7 +6,7 @@ from datetime import date import math import numpy as np - +import os # third party import pandas import epiweeks as epi @@ -44,23 +44,33 @@ def test_is_sane_week(self): def test_find_issue_specific_csv_files(self): """Recursively explore and find issue specific CSV files.""" - path_prefix='prefix/to/the/data/' - #valid day path - issue_path='issue_20200408' - glob_issue_path = path_prefix + issue_path - glob_file_path = path_prefix + issue_path + '/ght/20200408_state_rawsearch.csv' + # valid path + path_prefix='prefix/to/the/data/issue_20200408' + os.makedirs(path_prefix, exist_ok=True) + self.assertTrue(os.path.isdir(path_prefix)) + + issue_path=path_prefix+'ght/20200408_state_rawsearch.csv' mock_glob = MagicMock() - mock_glob.glob.side_effect = ([glob_issue_path], [glob_file_path]) + mock_glob.glob.side_effect = ([path_prefix], [issue_path]) - #check if the day is a valid issue day. - issuedir_match = CsvImporter.PATTERN_ISSUE_DIR.match(glob_issue_path.lower()) + #check if the day is a valid day. + issuedir_match= CsvImporter.PATTERN_ISSUE_DIR.match(path_prefix.lower()) issue_date_value = int(issuedir_match.group(2)) - self.assertTrue(CsvImporter.is_sane_day(issue_date_value)) - + found = set(CsvImporter.find_issue_specific_csv_files(path_prefix, glob=mock_glob)) self.assertTrue(len(found)>0) + # unvalid path: + path_prefix_invalid='invalid/prefix/to/the/data/issue_20200408' + self.assertFalse(os.path.isdir(path_prefix_invalid)) + issue_path_invalid=path_prefix_invalid+'ght/20200408_state_rawsearch.csv' + mock_glob_invalid = MagicMock() + mock_glob_invalid.glob.side_effect = ([path_prefix_invalid], [issue_path_invalid]) + found = set(CsvImporter.find_issue_specific_csv_files(path_prefix_invalid, glob=mock_glob_invalid)) + self.assertFalse(len(found)>0) + + def test_find_csv_files(self): """Recursively explore and find CSV files.""" From 54c8fad7f5634bad9eb7d964e5be1594bd484d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=84=B6=E7=84=B6?= <52230092+zhuoran-cheng@users.noreply.github.com> Date: Wed, 7 Jul 2021 18:15:34 -0400 Subject: [PATCH 12/12] change dir check to mock patch --- .../acquisition/covidcast/test_csv_importer.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/acquisition/covidcast/test_csv_importer.py b/tests/acquisition/covidcast/test_csv_importer.py index d11a67261..b82dec1ce 100644 --- a/tests/acquisition/covidcast/test_csv_importer.py +++ b/tests/acquisition/covidcast/test_csv_importer.py @@ -3,10 +3,12 @@ # standard library import unittest from unittest.mock import MagicMock +from unittest.mock import patch from datetime import date import math import numpy as np import os + # third party import pandas import epiweeks as epi @@ -42,14 +44,14 @@ def test_is_sane_week(self): self.assertFalse(CsvImporter.is_sane_week(202054)) self.assertFalse(CsvImporter.is_sane_week(20200418)) - def test_find_issue_specific_csv_files(self): + @patch("os.path.isdir") + def test_find_issue_specific_csv_files(self,os_isdir_mock): """Recursively explore and find issue specific CSV files.""" - # valid path + # check valid path path_prefix='prefix/to/the/data/issue_20200408' - os.makedirs(path_prefix, exist_ok=True) - self.assertTrue(os.path.isdir(path_prefix)) - + os_isdir_mock.return_value=True issue_path=path_prefix+'ght/20200408_state_rawsearch.csv' + mock_glob = MagicMock() mock_glob.glob.side_effect = ([path_prefix], [issue_path]) @@ -61,12 +63,13 @@ def test_find_issue_specific_csv_files(self): found = set(CsvImporter.find_issue_specific_csv_files(path_prefix, glob=mock_glob)) self.assertTrue(len(found)>0) - # unvalid path: + # check unvalid path: path_prefix_invalid='invalid/prefix/to/the/data/issue_20200408' - self.assertFalse(os.path.isdir(path_prefix_invalid)) + os_isdir_mock.return_value=False issue_path_invalid=path_prefix_invalid+'ght/20200408_state_rawsearch.csv' mock_glob_invalid = MagicMock() mock_glob_invalid.glob.side_effect = ([path_prefix_invalid], [issue_path_invalid]) + found = set(CsvImporter.find_issue_specific_csv_files(path_prefix_invalid, glob=mock_glob_invalid)) self.assertFalse(len(found)>0)