Skip to content

pytest-plugin: missing error when no anybodycon is found #142

@bkje14

Description

@bkje14

I ran into a case where my .any pytest would pass without being executed.
It happened when I was using the AnyPyTools pytest plugin inside an environment without anybodycon available (a GH runner).
I traced some of it back to this line where the test plugin is printing a dummy version when it can't find anybodycon.

I also see this warning triggered in my test logs.

Eventually I end up in s IOError when anypytools tries to execute the test:

D:\a\ammr\ammr\.pixi\envs\test\Lib\site-packages\anypytools\tools.py:588: UserWarning: Could not locate AnyBody in registry
    warnings.warn("Could not locate AnyBody in registry")

AnyMocap/Test_Plug-in-gait_simple_fullbody_ParamID.any::Test_Plug-in-gait_simple_fullbody_ParamID_0
  D:\a\ammr\ammr\.pixi\envs\test\Lib\site-packages\_pytest\threadexception.py:58: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-1 (_worker)
  
  Traceback (most recent call last):
    File "D:\a\ammr\ammr\.pixi\envs\test\Lib\threading.py", line 1043, in _bootstrap_inner
      self.run()
      ~~~~~~~~^^
    File "D:\a\ammr\ammr\.pixi\envs\test\Lib\threading.py", line 994, in run
      self._target(*self._args, **self._kwargs)
      ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "D:\a\ammr\ammr\.pixi\envs\test\Lib\site-packages\anypytools\abcutils.py", line 933, in _worker
      task.retcode = execute_anybodycon(**exe_args)
                     ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
    File "D:\a\ammr\ammr\.pixi\envs\test\Lib\site-packages\anypytools\abcutils.py", line 207, in execute_anybodycon
      raise IOError(f"Can not find anybodycon: {anybodycon_path}")
  OSError: Can not find anybodycon: .
  
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
    warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================ slowest 10 durations =============================
0.22s call     AnyMocap/Test_Plug-in-gait_simple_fullbody_ParamID.any::Test_Plug-in-gait_simple_fullbody_ParamID_0

(2 durations < 0.005s hidden.  Use -vv to show these durations.)
======================== 1 passed, 5 warnings in 1.59s ========================

The worrying thing is that the test is marked as passed and not failed.
My idea for fixing it was to make the plugin throw earlier during initialization - what do you think ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions