google / slo-generator

SLO Generator computes SLIs, SLOs, Error Budgets and Burn Rates from supported backends, then exports an SLO report to supported targets.
Apache License 2.0
489 stars 78 forks source link

Replace `nose` with another testing framework #253

Closed lvaylet closed 2 years ago

lvaylet commented 2 years ago

As per the official site:

Nose has been in maintenance mode for the past several years and will likely cease without a new person/team to take over maintainership. New projects should consider using Nose2, py.test, or just plain unittest/unittest2.

Migrate to a mature, maintained and well-known framework like pytest with a basic support for tests written for nose?

$ pip install pytest
$ python setup.py develop  # make sure tests can import our package
$ pytest  tests  # instead of 'nosetests tests/unit/*'

Coverage can be achieved with pytest-cov:

$ pip install pytest-cov
$ pytest --cov=slo_generator tests

[...]

---------- coverage: platform linux, python 3.9.14-final-0 -----------
Name                                                 Stmts   Miss  Cover
------------------------------------------------------------------------
slo_generator/__init__.py                                0      0   100%
slo_generator/api/__init__.py                            0      0   100%
slo_generator/api/main.py                               99     99     0%
slo_generator/backends/__init__.py                       0      0   100%
slo_generator/backends/cloud_monitoring.py              97     13    87%
slo_generator/backends/cloud_service_monitoring.py     294     59    80%
slo_generator/backends/datadog.py                       86     10    88%
slo_generator/backends/dynatrace.py                    128     42    67%
slo_generator/backends/elasticsearch.py                 63     11    83%
slo_generator/backends/prometheus.py                    81      8    90%
slo_generator/cli.py                                    73     10    86%
slo_generator/compute.py                                81      8    90%
slo_generator/constants.py                              31      0   100%
slo_generator/exporters/__init__.py                      0      0   100%
slo_generator/exporters/base.py                         69      9    87%
slo_generator/exporters/bigquery.py                     90     16    82%
slo_generator/exporters/cloud_monitoring.py             46      2    96%
slo_generator/exporters/cloudevent.py                   28     28     0%
slo_generator/exporters/datadog.py                      19      0   100%
slo_generator/exporters/dynatrace.py                    40      7    82%
slo_generator/exporters/prometheus.py                   35      6    83%
slo_generator/exporters/prometheus_self.py              28     13    54%
slo_generator/exporters/pubsub.py                       14      0   100%
slo_generator/migrations/__init__.py                     0      0   100%
slo_generator/migrations/migrator.py                   221    134    39%
slo_generator/report.py                                188     37    80%
slo_generator/utils.py                                 198     57    71%
------------------------------------------------------------------------
TOTAL                                                 2009    569    72%

============= 43 passed, 11 warnings in 10.08s =============