Skip to content

Fix doctests#105

Closed
cclauss wants to merge 1 commit into
bastibe:masterfrom
cclauss:fix-doctests
Closed

Fix doctests#105
cclauss wants to merge 1 commit into
bastibe:masterfrom
cclauss:fix-doctests

Conversation

@cclauss

@cclauss cclauss commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

DRAFT because there are 5 TODOs that I cannot fix because luarocks --local make fails on macOS.

Move doctests from a module docstring to a class docstring to make running them much more reliable.

% python tests/test_lua.py # passes silently
% python -m doctest --verbose tests/test_lua.py # "27 passed."

Modify the last line of the docstring to change 3 to 33...

% python tests/test_lua.py # "26 passed and 1 failed."
% python -m doctest --verbose tests/test_lua.py # "26 passed and 1 failed."

Use # doctest: +ELLIPSIS directives only on the tests where they are needed instead of requiring the global command-line option.

Proven to pass on:

@cclauss cclauss marked this pull request as ready for review July 7, 2026 19:37
@cclauss

cclauss commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

>>> lua.execute("python = require 'python'")

Different undefined symbols on each version of Lua (lua_isstring vs, lua_rotate).

On lua5.1:

    RuntimeError: error executing code: error loading module 'python' from file './python.so':
    	./python.so: undefined symbol: lua_isstring

On lua5.3:

    RuntimeError: error executing code: error loading module 'python' from file './python.so':
    	./python.so: undefined symbol: lua_rotate

@cclauss

cclauss commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Important

ALWAYS add the --lua-version option when running apt-installed luarocks!

All 8 tests pass at https://github.com/cclauss/lunatic-python/actions/runs/28926481993

@cclauss

cclauss commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@cclauss cclauss closed this Jul 8, 2026
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.

1 participant