tatuylonen/wikitextprocessor

How to run tests? module 'ustring:ustring' not found

empiriker opened this issue · 2 comments

In connection to #107, I wanted to run the test suite to verify that I didn't break anything.

However, following the instructions in the readme, I get the following error for multiple tests: lupa.lua51.LuaError: [string "<python>"]:80: module 'ustring:ustring' not found.

Apparently the lua modules are not correctly set up in the sandbox but I am not quite sure how to fix this. I expected the installation procedure to set everything up correctly.

Here the result of running make test with one exemplary error stack trace:

----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/till/VSCode/wikitextprocessor/tests/test_wikiprocess.py", line 4113, in test_title_1_colon_e
    self.scribunto("1:e", "return mw.title.new('1:e').text")
  File "/home/till/VSCode/wikitextprocessor/tests/test_wikiprocess.py", line 41, in scribunto
    ret = self.ctx.expand("{{#invoke:testmod|testfn}}", timeout=timeout)
  File "/home/till/VSCode/wikitextprocessor/wikitextprocessor/core.py", line 1623, in expand
    expanded = expand_recurse(encoded, parent, not pre_expand)
  File "/home/till/VSCode/wikitextprocessor/wikitextprocessor/core.py", line 1425, in expand_recurse
    ret = expand_parserfn(
  File "/home/till/VSCode/wikitextprocessor/wikitextprocessor/core.py", line 1353, in expand_parserfn
    ret = invoke_fn(args, expander, parent)
  File "/home/till/VSCode/wikitextprocessor/wikitextprocessor/core.py", line 1223, in invoke_fn
    ret = call_lua_sandbox(self, invoke_args, expander, parent, timeout)
  File "/home/till/VSCode/wikitextprocessor/wikitextprocessor/luaexec.py", line 435, in call_lua_sandbox
    initialize_lua(ctx)  # This sets ctx.lua
  File "/home/till/VSCode/wikitextprocessor/wikitextprocessor/luaexec.py", line 401, in initialize_lua
    call_set_functions(ctx, set_functions)
  File "/home/till/VSCode/wikitextprocessor/wikitextprocessor/luaexec.py", line 337, in call_set_functions
    set_functions(
  File "lupa/lua51.pyx", line 858, in lupa.lua51._LuaObject.__call__
  File "lupa/lua51.pyx", line 1750, in lupa.lua51.call_lua
  File "lupa/lua51.pyx", line 1776, in lupa.lua51.execute_lua_call
  File "lupa/lua51.pyx", line 1665, in lupa.lua51.raise_lua_error
lupa.lua51.LuaError: [string "<python>"]:80: module 'ustring:ustring' not found
stack traceback:
	[string "_sandbox_phase2"]:237: in function <[string "_sandbox_phase2"]:215>
	[string "mw"]:56: in function <[string "mw"]:51>
	[string "<python>"]:80: in function 'require'
	[C]: in function 'assert'

-------------------- >> begin captured stdout << ---------------------

--------------------- >> end captured stdout << ----------------------
----------------------------------------------------------------------
Ran 842 tests in 30.436s

FAILED (errors=231)

make: *** [Makefile:6: test] Error 1
xxyzz commented

Maybe you didn't init the git submodule?

Thanks! Indeed I didn't clone the repo with submodules initially.

For reference: In a repo cloned without submodules, this helped:

git submodule init
git submodule update --recursive --depth 1