Skip to content

Commit

Permalink
Run coverage around pytest (#813)
Browse files Browse the repository at this point in the history
* Run coverage around pytest

* Trigger tests

* Fixup

* Add redis client_no_touch to ignore list

* Temporarily remove kafka from coverage

* Remove coverage for old libs
  • Loading branch information
hmstepanek committed May 9, 2023
1 parent 3d82845 commit a963649
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 189 deletions.
7 changes: 7 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ ignore:
- "newrelic/hooks/framework_pylons.py"
- "newrelic/hooks/framework_web2py.py"
- "newrelic/hooks/middleware_weberror.py"
- "newrelic/hooks/framework_webpy.py"
- "newrelic/hooks/database_oursql.py"
- "newrelic/hooks/database_psycopg2ct.py"
- "newrelic/hooks/datastore_umemcache.py"
# Temporarily disable kafka
- "newrelic/hooks/messagebroker_kafkapython.py"
- "newrelic/hooks/messagebroker_confluentkafka.py"
1 change: 1 addition & 0 deletions tests/datastore_aioredis/test_uninstrumented_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"channels",
"client_tracking_off",
"client_tracking_on",
"client_no_touch",
"close",
"closed",
"connection_pool",
Expand Down
12 changes: 6 additions & 6 deletions tests/datastore_redis/test_uninstrumented_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,18 @@

import pytest
import redis

from testing_support.db_settings import redis_settings

DB_SETTINGS = redis_settings()[0]

redis_client = redis.Redis(host=DB_SETTINGS['host'], port=DB_SETTINGS['port'], db=0)
strict_redis_client = redis.StrictRedis(host=DB_SETTINGS['host'], port=DB_SETTINGS['port'], db=0)
redis_client = redis.Redis(host=DB_SETTINGS["host"], port=DB_SETTINGS["port"], db=0)
strict_redis_client = redis.StrictRedis(host=DB_SETTINGS["host"], port=DB_SETTINGS["port"], db=0)


IGNORED_METHODS = {
'MODULE_CALLBACKS',
'MODULE_VERSION',
'NAME',
"MODULE_CALLBACKS",
"MODULE_VERSION",
"NAME",
"add_edge",
"add_node",
"append_bucket_size",
Expand All @@ -44,6 +43,7 @@
"BatchIndexer",
"bulk",
"call_procedure",
"client_no_touch",
"client_tracking_off",
"client_tracking_on",
"client",
Expand Down
31 changes: 0 additions & 31 deletions tests/datastore_umemcache/conftest.py

This file was deleted.

143 changes: 0 additions & 143 deletions tests/datastore_umemcache/test_memcache.py

This file was deleted.

12 changes: 3 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ envlist =
redis-datastore_aredis-{py37,py38,py39,pypy37}-aredislatest,
solr-datastore_solrpy-{py27,pypy}-solrpy{00,01},
python-datastore_sqlite-{py27,py37,py38,py39,py310,py311,pypy,pypy37},
memcached-datastore_umemcache-{py27,pypy},
python-external_boto3-{py27,py37,py38,py39,py310,py311}-boto01,
python-external_botocore-{py37,py38,py39,py310,py311}-botocorelatest,
python-external_botocore-{py311}-botocore128,
Expand Down Expand Up @@ -173,7 +172,7 @@ deps =
{py37,py38,py39,py310,py311,pypy37}: pytest==7.2.2
{py27,pypy}: pytest==4.6.11
iniconfig
pytest-cov
coverage
WebTest==2.0.35

# Test Suite Dependencies
Expand Down Expand Up @@ -257,7 +256,6 @@ deps =
datastore_aredis-aredislatest: aredis
datastore_solrpy-solrpy00: solrpy<1.0
datastore_solrpy-solrpy01: solrpy<2.0
datastore_umemcache: umemcache<1.7
external_boto3-boto01: boto3<2.0
external_boto3-boto01: moto<2.0
external_boto3-py27: rsa<4.7.1
Expand Down Expand Up @@ -389,7 +387,6 @@ setenv =
with_extensions: NEW_RELIC_EXTENSIONS = true
without_extensions: NEW_RELIC_EXTENSIONS = false
agent_features: NEW_RELIC_APDEX_T = 1000
datastore_umemcache: CFLAGS="-Wno-error"
framework_grpc: PYTHONPATH={toxinidir}/tests/:{toxinidir}/tests/framework_grpc/sample_application
libcurl: PYCURL_SSL_LIBRARY=openssl
libcurl: LDFLAGS=-L/usr/local/opt/openssl/lib
Expand All @@ -409,8 +406,7 @@ commands =
framework_grpc: /{toxinidir}/tests/framework_grpc/sample_application/sample_application.proto

libcurl: pip install --ignore-installed --config-settings="--build-option=--with-openssl" pycurl

py.test -v []
coverage run -m pytest -v

install_command=
# Older pip versions that support python 2 have issues with using the cache directory and cause crashes on GitHub Actions
Expand Down Expand Up @@ -458,7 +454,6 @@ changedir =
datastore_aredis: tests/datastore_aredis
datastore_solrpy: tests/datastore_solrpy
datastore_sqlite: tests/datastore_sqlite
datastore_umemcache: tests/datastore_umemcache
external_boto3: tests/external_boto3
external_botocore: tests/external_botocore
external_feedparser: tests/external_feedparser
Expand Down Expand Up @@ -493,15 +488,14 @@ changedir =
template_mako: tests/template_mako

[pytest]
addopts = --cov="newrelic" --cov-report=html --cov-report=xml
usefixtures =
collector_available_fixture
collector_agent_registration

[coverage:run]
branch = True
parallel = True
disable_warnings = couldnt-parse
source = newrelic

[coverage:paths]
source =
Expand Down

0 comments on commit a963649

Please sign in to comment.