Skip to content

Commit

Permalink
Use blank string when description is unknown
Browse files Browse the repository at this point in the history
In cases when inserting a package which has already been deleted, the
current PyPI buffer indicates description is "None" (as we don't know
what the description is). Cloud-gazer in this case should simply default
to a blank string.
  • Loading branch information
waveform80 committed Aug 10, 2020
1 parent ba13438 commit 2ec3682
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion piwheels/master/cloud_gazer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def read_pypi(self):
if package not in self.packages:
self.packages.add(package)
if self.db.add_new_package(package, skip=self.skip_default,
description=description):
description=description or ''):
self.logger.info('added package %s', package)
self.web_queue.send_msg('BOTH', package)
self.web_queue.recv_msg()
Expand Down
29 changes: 29 additions & 0 deletions tests/master/test_cloud_gazer.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,35 @@ def test_new_ver(mock_events, db_queue, web_queue, task):
assert task.serial == 4


def test_new_ver_deleted(mock_events, db_queue, web_queue, task):
db_queue.expect('ALLPKGS')
db_queue.send('OK', {"foo"})
db_queue.expect('GETPYPI')
db_queue.send('OK', 2)
task.once()
db_queue.check()
mock_events[:] = [
# bar is already deleted, so description is None
('bar', None, dt('2018-07-11 16:43:07'), 'create', None),
('bar', '1.0', dt('2018-07-11 16:43:09'), 'source', None),
]
db_queue.expect('NEWPKG', ['bar', '', ''])
db_queue.send('OK', True)
web_queue.expect('BOTH', 'bar')
web_queue.send('DONE')
db_queue.expect('NEWVER', ['bar', '1.0', dt('2018-07-11 16:43:09'), ''])
db_queue.send('OK', True)
web_queue.expect('BOTH', 'bar')
web_queue.send('DONE')
db_queue.expect('SETPYPI', 4)
db_queue.send('OK', None)
task.poll(0)
db_queue.check()
web_queue.check()
assert task.packages == {"foo", "bar"}
assert task.serial == 4


def test_remove_ver(mock_events, db_queue, web_queue, skip_queue, task):
db_queue.expect('ALLPKGS')
db_queue.send('OK', {"foo"})
Expand Down

0 comments on commit 2ec3682

Please sign in to comment.