taichi icon indicating copy to clipboard operation
taichi copied to clipboard

[misc] python tests error that doesn't affect program execution

Open liaopeiyuan opened this issue 4 years ago • 5 comments

Describe the bug When running ti test, the main program throws an error saying that it is unable to recognize the argument -n1

Log/Screenshots

Running python tests...

ERROR: usage: ti [options] [file_or_dir] [file_or_dir] [...] ti: error: unrecognized arguments: -n1 inifile: None rootdir: /home/peiyuanl/taichi_dev/taichi

========================================================== test session starts =========================================================== platform linux -- Python 3.7.6, pytest-5.4.2, py-1.8.1, pluggy-0.13.1 rootdir: [omitted] plugins: xdoctest-0.12.0, cov-2.9.0

(the test successfully completed)

To Reproduce

Run ti test after correct setup and compilation on Ubuntu 16.04

liaopeiyuan avatar Jun 03 '20 07:06 liaopeiyuan

tl;dr: pip install pytest-xdist.

archibate avatar Jun 03 '20 08:06 archibate

For now we have to detect the pytest plugin xdist by running a dummy test: https://github.com/taichi-dev/taichi/blob/e9b30006e8d34ab37350b8c0fda588fa7df06c74/python/taichi/main.py#L624-L629

It would be great if we can find some pytest API to detect if xdist is installed or not, would you mind to fix this? Thanks in advance!

archibate avatar Jun 03 '20 08:06 archibate

Sure!

liaopeiyuan avatar Jun 03 '20 08:06 liaopeiyuan

I dug around and I think there isn't a easy work around.

  • I tried sys.module and xdist isn't listed
  • Then I tried some voodoo path parsing magic, and it seems that after uninstalling pytest-xdist, the folder still persists, so that didn't work either.

I guess right now we can print a few extra messages explaining that the error message is insignificant...

liaopeiyuan avatar Jun 04 '20 05:06 liaopeiyuan

Is this still unsolved?

SpirosArk avatar Jul 17 '22 19:07 SpirosArk