Skip to content

UserWarning: Unknown distribution option: 'tests_require' #368

@Plumezz

Description

@Plumezz

Describe the bug

When I build and test this project from source, some warnings about package canopen_utils occurred.

Logs
Here is the output of the command colcon build about canopen_utils:

Starting >>> canopen_utils
/home/qiguanxiao/.local/lib/python3.10/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'tests_require'
  warnings.warn(msg)
--- stderr: canopen_utils                                                                       
/home/qiguanxiao/.local/lib/python3.10/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'tests_require'
  warnings.warn(msg)
---
Finished <<< canopen_utils [1.29s]

And then I use colcon test to test this project, there were also some warnings.

This warning shows the tests_require option is expired. But the python and setuptools are default package with the ubuntu22.04.

Here is the output of the command colcon test about canopen_utils:

Starting >>> canopen_utils                  
/home/qiguanxiao/.local/lib/python3.10/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'tests_require'
  warnings.warn(msg)
--- stderr: canopen_utils                                                      

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
---
Finished <<< canopen_utils [0.41s]

It seems like that there were no python testing programs to run and no result file pytest.xml was generated in build directory.

Then I tried to modify the setup.py file in package canopen_utils and replaced the option tests_require with extras_require.

I also changed the directory no_tests to tests and removed the "_" at the beginning of the name of the test file in the folder to make them can be found.

Finally these packages can be built and test correctly.

Here is the modified conten in setpu.py file:

tests_require=["pytest"],  # remove
extras_require={
        'test': ['pytest'],
    },  # add

Setup:

  • Device:
  • OS: Ubuntu 22.04
  • ROS-Distro: Humble
  • Branch/Commit: humble
  • Python Version: 3.10.12
  • setuptools Version: 75.2.0

Additional context
Now the python and setuptools version are updated very quickly, could you tell me if it is necessary to modify the setup.py to adapt to the current environment.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions