Closed williamjoy closed 7 years ago
Since the bug was not causing tests to fail, can you add a test to cover the _sum_statistics
method? That will keep it from getting broken in the future
hi @shortdudey123 , I tried to add a test case which might cover it
test against old mesos.py
$ python2.7 ./test.py -c mesos -v
test_http (testmesos.TestMesosCollector) ... ok
test_https (testmesos.TestMesosCollector) ... ok
test_import (testmesos.TestMesosCollector) ... ok
test_should_compute_cpus_percent (testmesos.TestMesosCollector) ... ok
test_should_compute_cpus_utilisation (testmesos.TestMesosCollector) ... ok
test_should_fail_gracefully (testmesos.TestMesosCollector) ... ok
test_should_work_for_master_with_real_data (testmesos.TestMesosCollector) ... ok
test_should_work_for_slave_with_real_data (testmesos.TestMesosCollector) ... ok
test_sum_statistics (testmesos.TestMesosCollector) ... ok
----------------------------------------------------------------------
Ran 9 tests in 0.014s
OK
$ python2.6 ./test.py -c mesos -v
Failed to import module: testmesos. Traceback (most recent call last):
File "./test.py", line 246, in getCollectorTests
['*'])
File "/home/william.wei/Diamond/src/collectors/mesos/test/testmesos.py", line 14, in <module>
from mesos import MesosCollector
File "/home/william.wei/Diamond/src/collectors/mesos/mesos.py", line 177
for key in stats
^
SyntaxError: invalid syntax
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
awesome! thanks for showing the output of the new test with the old code :)
duplicated with pull request #626
https://www.python.org/dev/peps/pep-0274/#semantics