File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -114,19 +114,20 @@ def check_has_health_data(projects_list):
114114 return set ()
115115
116116 conditions = None
117+ projects_list = list (projects_list )
117118 # Check if projects_list also contains releases as a tuple of (project_id, releases)
118119 includes_releases = type (projects_list [0 ]) == tuple
119120
120121 if includes_releases :
121- filter_keys = {"project_id" : list ( {x [0 ] for x in projects_list }) }
122- conditions = [["release" , "IN" , list ( x [1 ] for x in projects_list ) ]]
122+ filter_keys = {"project_id" : {x [0 ] for x in projects_list }}
123+ conditions = [["release" , "IN" , [ x [1 ] for x in projects_list ] ]]
123124 query_cols = ["release" , "project_id" ]
124125
125126 def data_tuple (x ):
126127 return x ["project_id" ], x ["release" ]
127128
128129 else :
129- filter_keys = {"project_id" : list ( {x for x in projects_list }) }
130+ filter_keys = {"project_id" : {x for x in projects_list }}
130131 query_cols = ["project_id" ]
131132
132133 def data_tuple (x ):
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ def test_check_has_health_data(self):
143143 )
144144 assert data == {(self .project .id , self .session_release )}
145145
146- def test_check_has_health_data_without_releases_should_exlude_sessions_gt_90_days (self ):
146+ def test_check_has_health_data_without_releases_should_exclude_sessions_gt_90_days (self ):
147147 """
148148 Test that ensures that `check_has_health_data` returns a set of projects that has health
149149 data within the last 90d if only a list of project ids is provided and that any project
@@ -195,6 +195,10 @@ def test_check_has_health_data_without_releases_should_include_sessions_lte_90_d
195195 data = check_has_health_data ([self .project .id , project2 .id ])
196196 assert data == {self .project .id , project2 .id }
197197
198+ def test_check_has_health_data_does_not_crash_when_sending_projects_list_as_set (self ):
199+ data = check_has_health_data ({self .project .id })
200+ assert data == {self .project .id }
201+
198202 def test_get_project_releases_by_stability (self ):
199203 # Add an extra session with a different `distinct_id` so that sorting by users
200204 # is stable
You can’t perform that action at this time.
0 commit comments