summaryrefslogtreecommitdiff
path: root/buildstream/plugins
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-01-02 17:56:54 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-01-02 17:56:54 +0900
commitc8b3b4634d35387ce9cd01955f48c13e54090192 (patch)
treeb738bb9989760fa8d1bdbd26e45de11434fcc8f2 /buildstream/plugins
parent5084e66277d57398d9feb4f161fa8e114968cbe1 (diff)
downloadbuildstream-c8b3b4634d35387ce9cd01955f48c13e54090192.tar.gz
plugins/sources/_downloadablefilesource.py: Exclude a line from coverage
When fetching a downloadable source, we make a defensive check to avoid redundant download at fetch() time by checking if it's already cached, but fetch() will never be called if the source is already cached.
Diffstat (limited to 'buildstream/plugins')
-rw-r--r--buildstream/plugins/sources/_downloadablefilesource.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/buildstream/plugins/sources/_downloadablefilesource.py b/buildstream/plugins/sources/_downloadablefilesource.py
index 99eab340e..51b2a4c19 100644
--- a/buildstream/plugins/sources/_downloadablefilesource.py
+++ b/buildstream/plugins/sources/_downloadablefilesource.py
@@ -59,8 +59,13 @@ class DownloadableFileSource(Source):
return new_ref
def fetch(self):
+
+ # Just a defensive check, it is impossible for the
+ # file to be already cached because Source.fetch() will
+ # not be called if the source is already Consistency.CACHED.
+ #
if os.path.isfile(self._get_mirror_file()):
- return
+ return # pragma: nocover
# Download the file, raise hell if the sha256sums don't match,
# and mirror the file otherwise.