@@ -157,7 +157,7 @@ def test_update_supernav(self):
157157 release = self .python_3 ,
158158 slug = slug ,
159159 name = 'Python 3.10' ,
160- url = '/ftp/python/{}.zip' . format ( slug ) ,
160+ url = f '/ftp/python/{ slug } .zip' ,
161161 download_button = True ,
162162 )
163163
@@ -186,3 +186,47 @@ def test_update_supernav(self):
186186 self .assertIn ('class="download-os-windows"' , content )
187187 self .assertIn ('pymanager-25.0.msix' , content )
188188 self .assertIn ('python3.10-windows.zip' , content )
189+
190+ def test_update_supernav_skips_os_without_files (self ):
191+ """Test that update_supernav works when an OS has no download files.
192+
193+ Regression test for a bug where adding an OS (like Android) without
194+ any release files would cause update_supernav to silently abort,
195+ leaving the supernav showing outdated version information.
196+ """
197+ # Arrange
198+ from ..models import OS , update_supernav
199+ from boxes .models import Box
200+
201+ # Create an OS without any release files
202+ OS .objects .create (name = "Android" , slug = "android" )
203+
204+ # Create download files for other operating systems
205+ for os , slug in [
206+ (self .osx , "python3.10-macos" ),
207+ (self .linux , "python3.10-linux" ),
208+ (self .windows , "python3.10-windows" ),
209+ ]:
210+ ReleaseFile .objects .create (
211+ os = os ,
212+ release = self .python_3 ,
213+ slug = slug ,
214+ name = "Python 3.10" ,
215+ url = f"/ftp/python/{ slug } .zip" ,
216+ download_button = True ,
217+ )
218+
219+ # Act
220+ update_supernav ()
221+
222+ # Assert: verify supernav was updated
223+ box = Box .objects .get (label = "supernav-python-downloads" )
224+ content = box .content .rendered
225+
226+ # OSes with files should be present
227+ self .assertIn ('class="download-os-windows"' , content )
228+ self .assertIn ('class="download-os-macos"' , content )
229+ self .assertIn ('class="download-os-linux"' , content )
230+
231+ # Android (no files) should not be present
232+ self .assertNotIn ("android" , content .lower ())
0 commit comments