Skip to content

Commit 1409d72

Browse files
TimPansinolrafeeiumaannamalai
committed
Add support for GraphQL v3.2 (#463)
* Add support for GraphQL v3.2 Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Uma Annamalai <[email protected]> * Improve coverage fixture to output htmlcov and xml * Disable failing tornado tests Co-authored-by: Lalleh Rafeei <[email protected]> Co-authored-by: Uma Annamalai <[email protected]>
1 parent cf7a338 commit 1409d72

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

newrelic/hooks/framework_graphql.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,12 @@ def instrument_graphql_execute(module):
460460
wrap_function_wrapper(module, "get_field_def", wrap_get_field_def)
461461
if hasattr(module, "ExecutionContext"):
462462
wrap_function_wrapper(module, "ExecutionContext.__init__", wrap_executor_context_init)
463+
463464
if hasattr(module.ExecutionContext, "resolve_field"):
464465
wrap_function_wrapper(module, "ExecutionContext.resolve_field", wrap_resolve_field)
466+
elif hasattr(module.ExecutionContext, "execute_field"):
467+
wrap_function_wrapper(module, "ExecutionContext.execute_field", wrap_resolve_field)
468+
465469
if hasattr(module.ExecutionContext, "execute_operation"):
466470
wrap_function_wrapper(module, "ExecutionContext.execute_operation", wrap_execute_operation)
467471

tests/testing_support/fixtures.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,29 +2416,34 @@ def _override_ignore_status_codes(wrapped, instance, args, kwargs):
24162416
return _override_ignore_status_codes
24172417

24182418

2419-
def code_coverage_fixture(source=None):
2420-
source = source if source is not None else ["newrelic"]
2421-
2422-
@pytest.fixture(scope="session")
2419+
def code_coverage_fixture(source=['newrelic']):
2420+
@pytest.fixture(scope='session')
24232421
def _code_coverage_fixture(request):
24242422
if not source:
24252423
return
24262424

2427-
if os.environ.get("GITHUB_ACTIONS") is not None:
2425+
if os.environ.get('GITHUB_ACTIONS') is not None:
24282426
return
24292427

24302428
from coverage import coverage
24312429

2432-
coverage_directory = os.environ.get("TOX_ENVDIR", "htmlcov")
2433-
coverage_suffix = os.environ.get("TOX_ENV_NAME", None)
2430+
env_directory = os.environ.get('TOX_ENVDIR', None)
2431+
2432+
if env_directory is not None:
2433+
coverage_directory = os.path.join(env_directory, 'htmlcov')
2434+
xml_report = os.path.join(env_directory, 'coverage.xml')
2435+
else:
2436+
coverage_directory = 'htmlcov'
2437+
xml_report = 'coverage.xml'
24342438

24352439
def finalize():
24362440
cov.stop()
24372441
cov.html_report(directory=coverage_directory)
2442+
cov.xml_report(outfile=xml_report)
24382443

24392444
request.addfinalizer(finalize)
24402445

2441-
cov = coverage(source=source, branch=True, data_suffix=coverage_suffix)
2446+
cov = coverage(source=source, branch=True)
24422447
cov.start()
24432448

24442449
return _code_coverage_fixture

tox.ini

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,9 @@ envlist =
122122
python-framework_graphene-{py36,py37,py38,py39,py310}-graphenelatest,
123123
python-framework_graphene-{py27,py36,py37,py38,py39,pypy,pypy3}-graphene{0200,0201},
124124
python-framework_graphene-py310-graphene0201,
125-
python-framework_graphql-{py27,py36,py37,py38,py39,py310,pypy,pypy3}-graphql02,
126-
python-framework_graphql-{py36,py37,py38,py39,py310,pypy3}-graphql03,
127-
;temporarily disabling tests on graphql master
128-
python-framework_graphql-py37-graphql{0202,0203,0300,0301},
125+
python-framework_graphql-{py27,py36,py37,py38,py39,py310,pypy,pypy36}-graphql02,
126+
python-framework_graphql-{py36,py37,py38,py39,py310,pypy36}-graphql03,
127+
python-framework_graphql-py37-graphql{0202,0203,0300,0301,0302,master},
129128
grpc-framework_grpc-{py27,py36}-grpc0125,
130129
grpc-framework_grpc-{py36,py37,py38,py39,py310}-grpclatest,
131130
python-framework_pyramid-{pypy,py27,py38}-Pyramid0104,
@@ -137,7 +136,8 @@ envlist =
137136
python-framework_starlette-{py36,py37,py38,py39,py310,pypy3}-starlette{latest},
138137
python-framework_strawberry-{py37,py38,py39,py310}-strawberrylatest,
139138
libcurl-framework_tornado-{py36,py37,py38,py39,py310,pypy3}-tornado0600,
140-
libcurl-framework_tornado-{py36,py37,py38,py39,py310,pypy3}-tornadomaster,
139+
; Temp disable until other PR
140+
; libcurl-framework_tornado-{py36,py37,py38,py39,py310,pypy3}-tornadomaster,
141141
rabbitmq-messagebroker_pika-{py27,py36,py37,py38,py39,pypy,pypy3}-pika0.13,
142142
rabbitmq-messagebroker_pika-{py27,py36,py37,py38,py39,py310,pypy,pypy3}-pikalatest,
143143
python-template_mako-{py27,py36,py37,py38,py39,py310}
@@ -277,6 +277,7 @@ deps =
277277
framework_graphql-graphql0203: graphql-core<2.4
278278
framework_graphql-graphql0300: graphql-core<3.1
279279
framework_graphql-graphql0301: graphql-core<3.2
280+
framework_graphql-graphql0302: graphql-core<3.3
280281
framework_graphql-graphqlmaster: https://github.com/graphql-python/graphql-core/archive/main.zip
281282
framework_grpc-grpc0125: grpcio<1.26
282283
framework_grpc-grpc0125: grpcio-tools<1.26

0 commit comments

Comments
 (0)