Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Weaver): Use utf-8 encoding #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

goyalyashpal
Copy link

Problem: UnicodeEncodeError on trying to weave
Solution: Specify encoding="utf-8" while emitting
the woven target file

Fix #18

Problem: UnicodeEncodeError on trying to weave
Solution: Specify `encoding="utf-8"` while emitting 
        the woven target file

Fix slott56#18
@goyalyashpal
Copy link
Author

goyalyashpal commented Feb 9, 2024

result of pytest run, as given here:

$ pyweb -o tests tests/pyweb_test.w
INFO:Application:load, tangle and weave 3.2 WindowsPath('tests/pyweb_test.w')
INFO:ActionSequence:Starting load, tangle and weave
INFO:LoadAction:Starting Load
INFO:WebReader:Including 'tests\intro.w'
INFO:WebReader:Including 'tests\unit.w'
INFO:WebReader:Including 'tests\func.w'
INFO:WebReader:Including 'tests\scripts.w'
INFO:TangleAction:Starting Tangle
INFO:TanglerMake:Tangling test_unit.py
INFO:TanglerMake:Unchanged 'tests\test_unit.py'
INFO:TanglerMake:Tangling test_loader.py
INFO:TanglerMake:Unchanged 'tests\test_loader.py'
INFO:TanglerMake:Tangling test_tangler.py
INFO:TanglerMake:Unchanged 'tests\test_tangler.py'
INFO:TanglerMake:Tangling test_weaver.py
INFO:TanglerMake:Unchanged 'tests\test_weaver.py'
INFO:TanglerMake:Tangling test_scripts.py
INFO:TanglerMake:Unchanged 'tests\test_scripts.py'
INFO:TanglerMake:Tangling docutils.conf
INFO:TanglerMake:Unchanged 'tests\docutils.conf'
INFO:TanglerMake:Tangling page-layout.css
INFO:TanglerMake:Unchanged 'tests\page-layout.css'
INFO:WeaveAction:Starting Weave
INFO:Weaver:Weaving tests\pyweb_test.rst using rst markup
INFO:WeaveAction:Finished Normally
INFO:Application:Load 2297 lines from 5 files in 0.062 sec., Tangle 0 lines in 0.047 sec., Weave 3816 lines in 0.031 sec.

$ PYTHONPATH=$PIPX_HOME/venvs/py-web-lp/Lib/site-packages/ pytest
========================= test session starts =========================
platform win32 -- Python 3.11.2, pytest-8.0.0, pluggy-1.4.0
rootdir: D:\...\py-web-tool
collected 68 items

tests\test_loader.py ..                                          [  2%]
tests\test_scripts.py ..                                         [  5%]
tests\test_tangler.py ......                                     [ 14%]
tests\test_unit.py ...F.F....................................... [ 80%]
.........                                                        [ 94%]
tests\test_weaver.py ..F.                                        [100%]

============================== FAILURES =============================== 
______________ TestWeaver.test_weaver_functions_generic _______________ 

self = <test_unit.TestWeaver testMethod=test_weaver_functions_generic>  

...

tests\test_unit.py:240: AssertionError
------------------------ Captured stderr call ------------------------- 
INFO:Weaver:Weaving D:\...\py-web-tool\TestWeaver.rst using rst markup
-------------------------- Captured log call -------------------------- 
INFO     Weaver:pyweb.py:870 Weaving D:\...\py-web-tool\TestWeaver.rst using rst markup
_________________ TestHTML.test_weaver_functions_html _________________ 

self = <test_unit.TestHTML testMethod=test_weaver_functions_html>       

...

tests\test_unit.py:317: AssertionError
___________ Test_RefDefWeave.test_weave_should_create_html ____________ 

self = <test_weaver.Test_RefDefWeave testMethod=test_weave_should_create
_html>

...

tests\test_weaver.py:118: AssertionError
------------------------ Captured stderr call ------------------------- 
INFO:Weaver:Weaving D:\...\py-web-tool\test0.html using html markup 
-------------------------- Captured log call -------------------------- 
INFO     Weaver:pyweb.py:870 Weaving D:\...\py-web-tool\test0.html using html markup
======================= short test summary info ======================= 
FAILED tests/test_unit.py::TestWeaver::test_weaver_functions_generic 
- AssertionError: 'text[38 chars]n    → `sample.out (1)`_\n:named chu...   
FAILED tests/test_unit.py::TestHTML::test_weaver_functions_html 
- AssertionError: Lists differ: ['\n<[159 chars].\nUsed by &rarr;<a h...        
FAILED tests/test_weaver.py::Test_RefDefWeave::test_weave_should_create_html 
- AssertionError: '<htm[448 chars]&#8718; <em>some code (1)</em>.\n\n...
==================== 3 failed, 65 passed in 0.88s =====================

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.

UnicodeEncodeError: 'charmap' codec can't encode character
1 participant