Fix unicode/bytes handling in Tahoe config code
Fixes #225 (closed)
Note the target of this PR is #229 . Along with #231 this should make #229 green and then it can be merged into master to add Tahoe-LAFS 1.16.x testing to CI. For this branch alone many tests still fail against Tahoe-LAFS 1.16 but at least _zkapauthorizer.tests.test_plugin.ClientPluginTests.test_mismatched_ristretto_issuer
passes now.
Merge request reports
Activity
397 397 b"tub.port", 398 398 config_text.encode("utf-8"), 399 399 ) 400 config_text = BytesIO() 400 # On Tahoe-LAFS <1.16, the config is written as bytes. 401 # On Tahoe-LAFS >=1.16, the config is written as unicode. 402 # 403 # After support for Tahoe <1.16 support is dropped we probably want to 404 # switch to an io.StringIO here. 405 config_text = StringIO() Created by: tomprince
I guess we are depending on the fact that
StringIO.StringIO
automatically encodesunicode
tobytes
. That seems reasonable, but is maybe worth calling out. It is probably also worth calling out that this is aStringIO.StringIO
(I was initially confused by the suggestion to switch to aio.StringIO
when it is already a (different, as it turns out)StringIO
here.
Created by: codecov[bot]
Codecov Report
Merging #232 (a0dc0de8) into 228.tahoe-lafs-1.16.x-ci (b7d9b00e) will increase coverage by
0.07%
. The diff coverage is100.00%
.@@ Coverage Diff @@ ## 228.tahoe-lafs-1.16.x-ci #232 +/- ## ============================================================ + Coverage 96.92% 96.99% +0.07% ============================================================ Files 49 49 Lines 3999 3999 Branches 510 510 ============================================================ + Hits 3876 3879 +3 + Misses 80 78 -2 + Partials 43 42 -1
Impacted Files Coverage Δ src/_zkapauthorizer/tests/test_plugin.py 100.00% <100.00%> (ø)
src/_zkapauthorizer/tests/test_client_resource.py 98.32% <0.00%> (+0.27%)
src/_zkapauthorizer/tests/fixtures.py 100.00% <0.00%> (+5.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 b7d9b00...a0dc0de. Read the comment docs.