If we don't provide an fp parameter, then pytest subsequently fails when
it tries to look up a __name__ attribute on the exception object because
Python returns a KeyError in that case instead of an AttributeError. See
the linked bug for full details.
As a workaround, we can just supply an fp that behaves closer to what
might be expected, but with empty data.
build.py currently has no tests, so it's difficult to add a test for
this fix. But this is a trivial and obvious improvement, so I think it's
worth landing without.
Now that we have unpinned pygit2, the newer version of pygit2 provides a
pygit2.Repository.descendant_of() method directly, so we can drop our
temporary implementation and adjust the single caller.
We retain the test to ensure that the implementation swap does not
change behaviour.
With LP: #1918967 fixed in snapcraft, we must match and change the
substring of the fingerprint used for the public key file supplied to
snapcraft; otherwise the build fails.