Skip to content

Conversation

@HayaoSuzuki
Copy link
Contributor

@HayaoSuzuki HayaoSuzuki commented Jan 27, 2026

Replace deprecated gql() with GraphQLRequest in test_requests_batch.py

Use query.variable_values instead of deprecated variable_values argument in session.execute().

@HayaoSuzuki HayaoSuzuki changed the title Fix test for replace client Fix DeprecationWarning in test_requests_batch tests Jan 27, 2026
@HayaoSuzuki HayaoSuzuki marked this pull request as ready for review January 27, 2026 07:30
@leszekhanusz
Copy link
Collaborator

Sorry, could you please explain what you are trying to fix here? I don't see any DeprecationWarning with those tests?

@HayaoSuzuki
Copy link
Contributor Author

HayaoSuzuki commented Jan 27, 2026

@leszekhanusz
Thanks for taking a look.

When running pytest tests --cov=gql --cov-report=term-missing -vv on the master branch, I see 14 DeprecationWarning from test_requests_batch.py:

tests/test_requests_batch.py: 14 warnings
  /Users/hayao/PycharmProjects/gql/gql/client.py:899: DeprecationWarning: Using variable_values and operation_name arguments of execute and subscribe methods is deprecated. Instead, please use the variable_values and operation_name properties of GraphQLRequest
    request = support_deprecated_request(request, kwargs)

These warnings appear at the end of the test output in the "warnings summary" section.

Environment:

  • macOS Sequoia 15.7.3
  • Python 3.14.2 (final)

This PR aims to update the tests to use the new GraphQLRequest API instead of the deprecated pattern.

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7fb869a) to head (404655d).
⚠️ Report is 49 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##            master      #582    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           38        40     +2     
  Lines         2908      3311   +403     
==========================================
+ Hits          2908      3311   +403     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leszekhanusz
Copy link
Collaborator

Okay, I can now reproduce the warnings, but only if I activate the online tests with pytest tests/test_requests_batch.py --run-online

I don't understand how you get them without using the --run-online flag, that specific test should be skipped without it.

Anyway the problem is only one line, I don't see why you're introducing all those other changes and new tests, I suspect greedy llm output.

result = session.execute(query, variable_values=variables)

could simply be replaced by:

query.variable_values=variables
result = session.execute(query)

Please modify your PR to only those two lines. Please note that the gql method is NOT deprecated.

@HayaoSuzuki HayaoSuzuki force-pushed the fix-test-for-replace-client branch from 7da4e00 to 404655d Compare January 27, 2026 15:30
@HayaoSuzuki
Copy link
Contributor Author

Thank you for the detailed feedback.
I've reset the branch and made the minimal change you suggested.
I apologize for the noisy changes in the previous version.

@leszekhanusz leszekhanusz changed the title Fix DeprecationWarning in test_requests_batch tests Fix DeprecationWarning in test_requests_batch online tests Jan 27, 2026
@leszekhanusz leszekhanusz merged commit d2eddba into graphql-python:master Jan 27, 2026
16 checks passed
@leszekhanusz
Copy link
Collaborator

Thanks.

@HayaoSuzuki HayaoSuzuki deleted the fix-test-for-replace-client branch January 27, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants