Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 07ceff7

Browse files
committed
Don't enforce the test for the hack on old prometheus-client versions before it was possible
1 parent 47d4b9e commit 07ceff7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/test_metrics.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15+
import importlib.metadata
1516
from unittest.mock import Mock, patch
1617

18+
from pkg_resources import parse_version
19+
1720
from synapse.app._base import _set_prometheus_client_use_created_metrics
1821
from synapse.metrics import REGISTRY, InFlightGauge, generate_latest
1922
from synapse.util.caches.deferred_cache import DeferredCache
@@ -167,6 +170,11 @@ def test_cache_metric(self):
167170

168171

169172
class PrometheusMetricsHackTestCase(unittest.HomeserverTestCase):
173+
if parse_version(importlib.metadata.version("prometheus_client")) < parse_version(
174+
"0.14.0"
175+
):
176+
skip = "prometheus-client too old"
177+
170178
def test_created_metrics_disabled(self) -> None:
171179
"""
172180
Tests that a brittle hack, to disable `_created` metrics, works.

0 commit comments

Comments
 (0)