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

pyctest does not handle None gracefully #6

Open
carterbox opened this issue Mar 30, 2019 · 1 comment
Open

pyctest does not handle None gracefully #6

carterbox opened this issue Mar 30, 2019 · 1 comment

Comments

@carterbox
Copy link

I forgot to install nose, which means that pyctest was passed a command list which included None.

    # test properties
    props = {
        "DEPENDS": "correct_module",
        "RUN_SERIAL": "ON",
        "LABEL": "unit",
        "WORKING_DIRECTORY": binary_dir,
        "ENVIRONMENT": "TOMOPY_USE_C_ALGORITHMS=1"
        }

    # test command: python $(which coverage) run $(which nosetest)
    cmd = ['/opt/miniconda/envs/travis/bin/python', None, 'run', None]

The resulting RuntimeError was esoteric.

Error running pyctest - Unable to cast Python instance to C++ type (compile in debug mode for details)
Traceback (most recent call last):
  File "pyctest_tomopy.py", line 326, in <module>
    run_pyctest()
  File "pyctest_tomopy.py", line 307, in run_pyctest
    create_nosetest_test(args)
  File "/home/chingd/Documents/tomopy/benchmarking/__init__.py", line 244, in create_nosetest_test
    pyctest.test("nosetests", cmd, props)
RuntimeError: Unable to cast Python instance to C++ type (compile in debug mode for details)

It should probably return a TypeError with a message about how commands cannot be None.

@jrmadsen
Copy link
Owner

I appreciate you reporting this. That failed cast is (obviously, of course) happening in the C++ code but the lack of info is due to PyBind11 (not my code). However, I found some PyBind11 documentation about customizing exception handling but I currently can't really prioritize patching this due to more pressing things on my plate since the error is being detected and just not giving a whole lot of info, as opposed to not being detected (which would be much more concerning).

When I do get around to it though and if I find an elegant solution, I might actually just submit the change to PyBind11 itself.

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