Error testing the standard library

I am following the instructions from here to run the tests on the latest main. After creating the mojo-nightly project I am running the following command:

magic run --manifest-path mojo-nightly mojo test

This generates multiple errors, the first few below. Am I missing something in the process?

❯ magic run --manifest-path mojo-nightly mojo test
/var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:3528:19: error: use of unknown declaration 'test_static_int_tuple'
    `test_tuple`.`test_static_int_tuple`()
                  ^~~~~~~~~~~~~~~~~~~~~
/var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:3531:19: error: use of unknown declaration 'test_tuple_literal'
    `test_tuple`.`test_tuple_literal`()
                  ^~~~~~~~~~~~~~~~~~
Included from /var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:285:
/Users/mseritan/dev/max/mojo/stdlib/test/builtin/test_swap.mojo:15:6: error: unable to locate module 'test_utils'
from test_utils import MoveOnly
     ^
Included from /var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:315:
/Users/mseritan/dev/max/mojo/stdlib/test/collections/string/test_inlined_string.mojo:40:17: error: no matching function in call to 'assert_equal'
    assert_equal(s, "hello world")
    ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:1:1: note: candidate not viable: could not deduce parameter 'T' of callee 'assert_equal'
import `test_base64`
^
Included from /var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:315:
/Users/mseritan/dev/max/mojo/stdlib/test/collections/string/test_inlined_string.mojo:40:18: note: failed to infer parameter 'T', argument type '_FixedString[50]' does not conform to trait 
'Testable'
    assert_equal(s, "hello world")
                 ^
/var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:1:1: note: candidate not viable: argument #0 cannot be converted from '_FixedString[50]' to 'String'
import `test_base64`
^
/var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:1:1: note: candidate not viable: could not deduce parameter 'dtype' of callee 'assert_equal'
import `test_base64`
^
Included from /var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:315:
/Users/mseritan/dev/max/mojo/stdlib/test/collections/string/test_inlined_string.mojo:40:17: note: failed to infer parameter 'dtype', parameter isn't used in any argument
    assert_equal(s, "hello world")
    ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:1:1: note: candidate not viable: could not deduce parameter 'T' of callee 'assert_equal'
import `test_base64`
^
Included from /var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:315:
/Users/mseritan/dev/max/mojo/stdlib/test/collections/string/test_inlined_string.mojo:40:17: note: failed to infer parameter 'T', parameter isn't used in any argument
    assert_equal(s, "hello world")
    ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:1:1: note: candidate not viable: could not deduce parameter 'O1' of callee 'assert_equal'
import `test_base64`
^
Included from /var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:315:
/Users/mseritan/dev/max/mojo/stdlib/test/collections/string/test_inlined_string.mojo:40:17: note: failed to infer parameter 'O1', parameter isn't used in any argument
    assert_equal(s, "hello world")
    ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:1:1: note: candidate not viable: could not deduce parameter 'D' of callee 'assert_equal' (1 more notes omitted.)
import `test_base64`
^
Included from /var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:315:
/Users/mseritan/dev/max/mojo/stdlib/test/collections/string/test_inlined_string.mojo:46:21: error: no matching function in call to 'assert_equal'
        assert_equal(
        ~~~~~~~~~~~~^
/var/folders/yg/_vw4ktqx5dn6t75j_hng0tvc0000gn/T/test-6d365e.mojo:1:1: note: candidate not viable: could not deduce parameter 'T' of callee 'assert_equal'
import `test_base64`
^

Many thanks,

Marius

I usually just cd into the stdlib directory (e.g. mojo-nightly/mojo) and run magic run tests. Hope that helps.

1 Like

Thanks a lot @sora. I am definitely missing something.

Following the instructions in the web page I cd in the max/mojo folder and I ran magic init mojo-nightly --format mojoproject. The mojo-nightly folder is a subfolder of mojo and there is nothing in it.

❯ cd mojo-nightly/mojo
cd: no such file or directory: mojo-nightly/mojo

If I forget about mojo-nightly then magic run tests just works.

Ah, mojo-nightly is just a placeholder for whatever folder you cloned the repo into—it doesn’t have any significance on its own.

Ah, I got confused, thanks for the help!

Submitted my first PR [stdlib] Add PyCapsule_New and PyCapsule_GetPointer by winding-lines · Pull Request #4334 · modular/max · GitHub

1 Like