dapper91 / pjrpc

python json-rpc client/server without boilerplate
https://pjrpc.readthedocs.io
The Unlicense
30 stars 3 forks source link

tests/server/test_werkzeug.py: Fix test for github actions #63

Closed bernhardkaindl closed 2 years ago

bernhardkaindl commented 2 years ago

Fix: TypeError: cannot unpack non-iterable TestResponse object

Add support for testing with werkzeug 2.1 while keeping tuple unpacking for werkzeug 1.0. This should fix the github checks for pull requests.

The github checks for 3.9 now use Werkzeug 2.1 which no longer provides a TestResponse as a tuple, resulting in this TypeError.

3.6 shows this warning: DeprecationWarning: The test client no longer returns a tuple, it returns a 'TestResponse'. Tuple unpacking is deprecated and will be removed in Werkzeug 2.1. Access the attributes 'data', 'status', and 'headers' instead.

bernhardkaindl commented 2 years ago

Ups, sorry, total clash: Now I understood: It seems you liked the idea to support both, werkzeug 1.0 and 2.1 in the tests.

To make my initial push mergeable, you force-pushed the the orignal commit, backing out your last change. Got it!

bernhardkaindl commented 2 years ago

I'll also force-push my initial commit of this PR now to restore it ;-)

bernhardkaindl commented 2 years ago

@dapper91 I've recovered my initial commit for this PR to support both, Werkzeug 1.0 and 2.1 in the tests:

You can start/approve the workflow now.

dapper91 commented 2 years ago

Sorry, had some misunderstanding. Lets keep your solution.

codecov-commenter commented 2 years ago

Codecov Report

Merging #63 (92151f2) into dev (b3b7e3b) will increase coverage by 0.03%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              dev      #63      +/-   ##
==========================================
+ Coverage   78.63%   78.67%   +0.03%     
==========================================
  Files          38       38              
  Lines        2373     2377       +4     
==========================================
+ Hits         1866     1870       +4     
  Misses        507      507              
Flag Coverage Δ
unittests 78.67% <100.00%> (+0.03%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pjrpc/__about__.py 100.00% <100.00%> (ø)
pjrpc/client/integrations/pytest.py 93.44% <100.00%> (+0.22%) :arrow_up:
pjrpc/server/dispatcher.py 87.44% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f81af98...92151f2. Read the comment docs.