PythonRobotics icon indicating copy to clipboard operation
PythonRobotics copied to clipboard

Proposal : improve testing configuration

Open sjev opened this issue 3 years ago • 2 comments

Currently the tests are located in tests folder which also contains an __init__.py file. It should not be there as it causes quite some import issues as described here Also a conftest.py hack is used to make the tests run.

A better and clener way would be to add the library to the python path by installing it with pip in editable mode

pip install -e .

( to do this a setup.py needs to be added to the root folder.) I've included one in my recent pull request.

The result would be that the modules can be imported during testing without any hacking, like this:

from PathPlanning.AStar import a_star as m


def test_1():
    m.show_animation = False
    m.main()

no conftest is needed

So my proposal is to:

  1. make the PythonRobotics library installable by adding setup.py
  2. remove conftest.py workaround

sjev avatar Apr 09 '21 11:04 sjev

Thank you for your proposal!! I'm sorry for late reply.

  1. make the PythonRobotics library installable by adding setup.py

I think adding setup.py for this repo, it might fix the dependency hack issue like #486 A PR is wellcome!!

  1. remove conftest.py workaround

If remove the `conftest.py', how can we run the test of a specific test file?

AtsushiSakai avatar May 03 '21 13:05 AtsushiSakai

Hi,

I'm interested to create a setup.py file for the tests directory (and remove init.py). Just to clarify the structure of the file, I'm eager to follow the scipy setup.py, not everything in there but somewhat similar. Do you think it will fulfill all our needs or do you have any other suggestions? Thank you.

kajal-puri avatar Oct 18 '21 11:10 kajal-puri