Skip to content

Commit d3a8710

Browse files
committed
Update tests
1 parent ab6579d commit d3a8710

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

tests/unit/packaging/test_services.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ def test_check_project_name_typosquatting_prohibited(self, db_session):
10571057
ProhibitedProjectFactory.create(name="numpy")
10581058

10591059
with pytest.raises(ProjectNameUnavailableTypoSquattingError):
1060-
service.check_project_name("numpi")
1060+
service.check_project_name_after_insert("numpi")
10611061

10621062
def test_check_project_name_ok(self, db_session):
10631063
service = ProjectService(session=db_session)

warehouse/packaging/models.py

+3
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,9 @@ def yanked_releases(self):
505505
@event.listens_for(Project, "after_insert")
506506
def receive_after_insert(mapper, connection, project):
507507
request = get_current_request()
508+
if not request:
509+
# Can't do anything if there isn't a request
510+
return
508511
project_service = request.find_service(IProjectService)
509512
name = project.name
510513
try:

0 commit comments

Comments
 (0)