File tree 3 files changed +26
-3
lines changed
3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ class Meta:
75
75
76
76
uploader = factory .SubFactory (UserFactory )
77
77
description = factory .SubFactory (DescriptionFactory )
78
+ files = []
78
79
79
80
80
81
class FileFactory (WarehouseFactory ):
Original file line number Diff line number Diff line change 31
31
unindex_project ,
32
32
)
33
33
34
- from ...common .db .packaging import ProjectFactory , ReleaseFactory
34
+ from ...common .db .packaging import FileFactory , ProjectFactory , ReleaseFactory
35
35
36
36
37
37
def test_project_docs (db_session ):
@@ -45,6 +45,15 @@ def test_project_docs(db_session):
45
45
for p in projects
46
46
}
47
47
48
+ for p in projects :
49
+ for r in releases [p ]:
50
+ f = FileFactory .create (
51
+ release = r ,
52
+ filename = "{}-{}.tar.gz" .format (p .name , r .version ),
53
+ python_version = "source" ,
54
+ )
55
+ r .files .append (f )
56
+
48
57
assert list (_project_docs (db_session )) == [
49
58
{
50
59
"_id" : p .normalized_name ,
@@ -75,6 +84,15 @@ def test_single_project_doc(db_session):
75
84
for p in projects
76
85
}
77
86
87
+ for p in projects :
88
+ for r in releases [p ]:
89
+ f = FileFactory .create (
90
+ release = r ,
91
+ filename = "{}-{}.tar.gz" .format (p .name , r .version ),
92
+ python_version = "source" ,
93
+ )
94
+ r .files .append (f )
95
+
78
96
assert list (_project_docs (db_session , project_name = projects [1 ].name )) == [
79
97
{
80
98
"_id" : p .normalized_name ,
Original file line number Diff line number Diff line change 37
37
from warehouse .utils .db import windowed_query
38
38
39
39
40
- def _project_docs (db , project_name = None ):
40
+ def _project_docs (db , project_name = None , show_empty_releases = False ):
41
+
42
+ queries = [Release .yanked .is_ (False )]
43
+ if not show_empty_releases :
44
+ queries .append (Release .files )
41
45
42
46
releases_list = (
43
47
db .query (Release .id )
44
- .filter (Release . yanked . is_ ( False ), Release . files )
48
+ .filter (* queries )
45
49
.order_by (
46
50
Release .project_id ,
47
51
Release .is_prerelease .nullslast (),
You can’t perform that action at this time.
0 commit comments