Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions 2 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ language: python

matrix:
include:
- python: "2.6"
env: TOXENV=py26
- python: "2.7"
env: TOXENV=py27
- python: "2.7"
Expand Down
1 change: 1 addition & 0 deletions 1 setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"Intended Audience :: System Administrators",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
Expand Down
10 changes: 7 additions & 3 deletions 10 tests/test_exposition.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from __future__ import unicode_literals
import os

import sys
import threading
import time
import unittest

if sys.version_info < (2, 7):
# We need the skip decorators from unittest2 on Python 2.6.
import unittest2 as unittest
else:
import unittest

from prometheus_client import Gauge, Counter, Summary, Histogram, Metric
from prometheus_client import CollectorRegistry, generate_latest
Expand Down Expand Up @@ -39,6 +42,7 @@ def test_summary(self):
s.labels('c', 'd').observe(17)
self.assertEqual(b'# HELP ss A summary\n# TYPE ss summary\nss_count{a="c",b="d"} 1.0\nss_sum{a="c",b="d"} 17.0\n', generate_latest(self.registry))

@unittest.skipIf(sys.version_info < (2, 7), "Test requires Python 2.7+.")
def test_histogram(self):
s = Histogram('hh', 'A histogram', registry=self.registry)
s.observe(0.05)
Expand Down
11 changes: 9 additions & 2 deletions 11 tests/test_parser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from __future__ import unicode_literals

import unittest
import sys

if sys.version_info < (2, 7):
# We need the skip decorators from unittest2 on Python 2.6.
import unittest2 as unittest
else:
import unittest

from prometheus_client.core import *
from prometheus_client.exposition import *
Expand Down Expand Up @@ -36,7 +42,7 @@ def test_summary_quantiles(self):
a_count 1
a_sum 2
a{quantile="0.5"} 0.7
""")
""")
# The Python client doesn't support quantiles, but we
# still need to be able to parse them.
metric_family = SummaryMetricFamily("a", "help", count_value=1, sum_value=2)
Expand Down Expand Up @@ -131,6 +137,7 @@ def test_escaping(self):
metric_family.add_metric(["b\\a\\z"], 2)
self.assertEqual([metric_family], list(families))

@unittest.skipIf(sys.version_info < (2, 7), "Test requires Python 2.7+.")
def test_roundtrip(self):
text = """# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
Expand Down
7 changes: 6 additions & 1 deletion 7 tests/test_twisted.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from __future__ import absolute_import, unicode_literals

from unittest import skipUnless
import sys

if sys.version_info < (2, 7):
from unittest2 import skipUnless
else:
from unittest import skipUnless

from prometheus_client import Counter
from prometheus_client import CollectorRegistry, generate_latest
Expand Down
6 changes: 4 additions & 2 deletions 6 tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = coverage-clean,py27,py34,py35,pypy,{py27,py35}-nooptionals,coverage-report
envlist = coverage-clean,py26,py27,py34,py35,pypy,{py27,py35}-nooptionals,coverage-report


[base]
Expand All @@ -10,7 +10,9 @@ deps =
[testenv]
deps =
{[base]deps}
twisted
py26: unittest2
; Twisted does not support Python 2.6.
{py27,py34,py35,pypy}: twisted
commands = coverage run --parallel -m pytest {posargs}


Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.