plugins: Delay warnings emitted during load time to plugin access time
Showing 1 of 3 files from the diff.
master/buildbot/plugins/db.py
changed.
Other files ignored by Codecov
@@ -16,6 +16,7 @@
Loading
16 | 16 | # pylint: disable=C0111 |
|
17 | 17 | ||
18 | 18 | import traceback |
|
19 | + | import warnings |
|
19 | 20 | from pkg_resources import iter_entry_points |
|
20 | 21 | ||
21 | 22 | from zope.interface import Invalid |
@@ -35,10 +36,14 @@
Loading
35 | 36 | self._entry = entry |
|
36 | 37 | self._value = None |
|
37 | 38 | self._loader = loader |
|
39 | + | self._load_warnings = [] |
|
38 | 40 | ||
39 | 41 | def load(self): |
|
40 | 42 | if self._value is None: |
|
41 | - | self._value = self._loader(self._entry) |
|
43 | + | with warnings.catch_warnings(record=True) as all_warnings: |
|
44 | + | warnings.simplefilter("always") |
|
45 | + | self._value = self._loader(self._entry) |
|
46 | + | self._load_warnings = list(all_warnings) |
|
42 | 47 | ||
43 | 48 | @property |
|
44 | 49 | def group(self): |
@@ -59,6 +64,8 @@
Loading
59 | 64 | @property |
|
60 | 65 | def value(self): |
|
61 | 66 | self.load() |
|
67 | + | for w in self._load_warnings: |
|
68 | + | warnings.warn_explicit(w.message, w.category, w.filename, w.lineno) |
|
62 | 69 | return self._value |
|
63 | 70 | ||
64 | 71 |
Files | Coverage |
---|---|
master/buildbot | 92.22% |
worker/buildbot_worker | 85.50% |
Project Totals (338 files) | 91.80% |
586944760
586944760
586944760
586944760
586944760
586944760
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.