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

tests fail because they call out lua without prefixing LUA_PATH with the path towards the local argparse #14

Open
teto opened this issue Feb 25, 2020 · 1 comment

Comments

@teto
Copy link

teto commented Feb 25, 2020

So I was trying to debug the tests in nixos and I noticed some failing tests because the test could not include argparse.
On gitter @hishamhm said supposedly busted should add ./src/?.lua to your package path automatically (see flag -m). not sure what's going on..
so I added some print commands to busted and indeed it correctly adds argparse.

added path
./src/?.lua;./src/?/?.lua;./src/?/init.lua;/nix/store/1hkmba25rd8niqcx43v513f5f4skr123-lua5.2-busted-2.0.rc13-0/share/lua/5.2/?.lua;/nix/store/1hkmba25rd8niqcx43v513f5f4skr123-lua5.2-busted-2.0.rc13-0/share/lua/5.2/?/init.lua;/nix/store/068gwnrg3a7crk2dyvd4mx5amqy151nh-lua5.2-lua_cliargs-3.0-2/share/lua/5.2/?.lua;/nix/store/068gwnrg3a7crk2dyvd4mx5amqy151nh-lua5.2-lua_cliargs-3.0-2/share/lua/5.2/?/init.lua;/nix/store/x1jy8mgaaplrh9lnwdljjms1ixhmp87b-lua5.2-luasystem-0.2.1-0/share/lua/5.2/?.lua;/nix/store/x1jy8mgaaplrh9lnwdljjms1ixhmp87b-lua5.2-luasystem-0.2.1-0/share/lua/5.2/?/init.lua;/nix/store/dxl491mfb7g5787nccb2z992kyph16lc-lua5.2-dkjson-2.5-2/share/lua/5.2/?.lua;/nix/store/dxl491mfb7g5787nccb2z992kyph16lc-lua5.2-dkjson-2.5-2/share/lua/5.2/?/init.lua;/nix/store/j0kaismxsgzjcrn6c0qqxjd8zmggf77g-lua5.2-say-1.3-1/share/lua/5.2/?.lua;/nix/store/j0kaismxsgzjcrn6c0qqxjd8zmggf77g-lua5.2-say-1.3-1/share/lua/5.2/?/init.lua;/nix/store/kqp96xhqf9zk32ww8h8iasbg8796z0pv-lua5.2-luassert-1.7.11-0/share/lua/5.2/?.lua;/nix/store/kqp96xhqf9zk32ww8h8iasbg8796z0pv-lua5.2-luassert-1.7.11-0/share/lua/5.2/?/init.lua;/nix/store/pkm22p8r5hir4m1qp7cgp8wq7qi0r8lm-lua5.2-lua-term-0.7-1/share/lua/5.2/?.lua;/nix/store/pkm22p8r5hir4m1qp7cgp8wq7qi0r8lm-lua5.2-lua-term-0.7-1/share/lua/5.2/?/init.lua;/nix/store/wjm6nlchlakamzgk5z60rlfiyqb4jbk4-lua5.2-penlight-1.5.4-1/share/lua/5.2/?.lua;/nix/store/wjm6nlchlakamzgk5z60rlfiyqb4jbk4-lua5.2-penlight-1.5.4-1/share/lua/5.2/?/init.lua;/nix/store/43xslh3akjcdjj45v67ngjqsg2v6dw5q-lua5.2-mediator_lua-1.1.2-0/share/lua/5.2/?.lua;/nix/store/43xslh3akjcdjj45v67ngjqsg2v6dw5q-lua5.2-mediator_lua-1.1.2-0/share/lua/5.2/?/init.lua;/nix/store/nkissmc855jii0qnlaszk4f0mjdd9ywk-luarocks-3.3.1/share/lua/5.2/?.lua;/nix/store/nkissmc855jii0qnlaszk4f0mjdd9ywk-luarocks-3.3.1/share/lua/5.2/?/init.lua
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●◼◼◼●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
174 successes / 18 failures / 0 errors / 0 pending : 0.114934 seconds

Failure → spec/completion_spec.lua @ 18
tests related to generation of shell completion scripts generates correct bash completion script
spec/completion_spec.lua:19: Expected objects to be equal.
Passed in:
(string) 'lua: ./spec/comptest:3: module 'argparse' not found:
	no field package.preload['argparse']
	no file '/nix/store/1hkmba25rd8niqcx43v513f5f4skr123-lua5.2-busted-2.0.rc13-0/share/lua/5.2/argparse.lua'
	no file '/nix/store/1hkmba25rd8niqcx43v513f5f4skr123-lua5.2-busted-2.0.rc13-0/share/lua/5.2/argparse/init.lua'
	no file '/nix/store/068gwnrg3a7crk2dyvd4mx5amqy151nh-lua5.2-lua_cliargs-3.0-2/share/lua/5.2/argparse.lua'
	no file '/nix/store/068gwnrg3a7crk2dyvd4mx5amqy151nh-lua5.2-lua_cliargs-3.0-2/share/lua/5.2/argparse/init.lua'
	no file '/nix/store/x1jy8mgaaplrh9lnwdljjms1ixhmp87b-lua5.2-luasystem-0.2.1-0/share/lua/5.2/argparse.lua'
	no file '/nix/store/x1jy8mgaaplrh9lnwdljjms1ixhmp87b-lua5.2-luasystem-0.2.1-0/share/lua/5.2/argparse/init.lua'
	no file '/nix/store/dxl491mfb7g5787nccb2z992kyph16lc-lua5.2-dkjson-2.5-2/share/lua/5.2/argparse.lua'
	no file '/nix/store/dxl491mfb7g5787nccb2z992kyph16lc-lua5.2-dkjson-2.5-2/share/lua/5.2/argparse/init.lua'
	no file '/nix/store/j0kaismxsgzjcrn6c0qqxjd8zmggf77g-lua5.2-say-1.3-1/share/lua/5.2/argparse.lua'
	no file '/nix/store/j0kaismxsgzjcrn6c0qqxjd8zmggf77g-lua5.2-say-1.3-1/share/lua/5.2/argparse/init.lua'
	no file '/nix/store/kqp96xhqf9zk32ww8h8iasbg8796z0pv-lua5.2-luassert-1.7.11-0/share/lua/5.2/argparse.lua'
	no file '/nix/store/kqp96xhqf9zk32ww8h8iasbg8796z0pv-lua5.2-luassert-1.7.11-0/share/lua/5.2/argparse/init.lua'
	no file '/nix/store/pkm22p8r5hir4m1qp7cgp8wq7qi0r8lm-lua5.2-lua-term-0.7-1/share/lua/5.2/argparse.lua'
	no file '/nix/store/pkm22p8r5hir4m1qp7cgp8wq7qi0r8lm-lua5.2-lua-term-0.7-1/share/lua/5.2/argparse/init.lua'
	no file '/nix/store/wjm6nlchlakamzgk5z60rlfiyqb4jbk4-lua5.2-penlight-1.5.4-1/share/lua/5.2/argparse.lua'
	no file '/nix/store/wjm6nlchlakamzgk5z60rlfiyqb4jbk4-lua5.2-penlight-1.5.4-1/share/lua/5.2/argparse/init.lua'
	no file '/nix/store/43xslh3akjcdjj45v67ngjqsg2v6dw5q-lua5.2-mediator_lua-1.1.2-0/share/lua/5.2/argparse.lua'
	no file '/nix/store/43xslh3akjcdjj45v67ngjqsg2v6dw5q-lua5.2-mediator_lua-1.1.2-0/share/lua/5.2/argparse/init.lua'
	no file '/nix/store/nkissmc855jii0qnlaszk4f0mjdd9ywk-luarocks-3.3.1/share/lua/5.2/argparse.lua'
	no file '/nix/store/nkissmc855jii0qnlaszk4f0mjdd9ywk-luarocks-3.3.1/share/lua/5.2/argparse/init.lua'
	no file '/nix/store/p9m4q909i71fzazcg3d3ixjfnjad0x9g-lua5.2-luafilesystem-1.7.0-2/lib/lua/5.2/argparse.so'
	no file '/nix/store/x1jy8mgaaplrh9lnwdljjms1ixhmp87b-lua5.2-luasystem-0.2.1-0/lib/lua/5.2/argparse.so'
	no file '/nix/store/pkm22p8r5hir4m1qp7cgp8wq7qi0r8lm-lua5.2-lua-term-0.7-1/lib/lua/5.2/argparse.so'
stack traceback:

the errors happen when it calls out lua spec/test.lua since in that case LUA_PATH doesn't contain the prefixed path for the local argparse. I am not sure how the tests succeed on other platforms, most likely some tests run against an already installed version of argparse.

@daurnimator
Copy link
Member

Would the solution be to pass "-e package.path=[[" .. package.path .. "]]" (and the same for cpath?)

Also using arg[0] for script_cmd?

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

No branches or pull requests

2 participants