Closed tjni closed 2 years ago
It is quite strange to have an __init__.py
in a tests folder. Loading assets with absolute paths is I think a good idea.
It is quite strange to have an
__init__.py
in a tests folder. Loading assets with absolute paths is I think a good idea.
Removed the __init__.py
. The command to run now from the root is python -m unittest discover -s test
.
It is quite strange to have an
__init__.py
in a tests folder.
I see quite a lot of projects that do it -- and it's how unittest
's discovery finds the tests without having to specify the paths. Why is it strange, in your opinion?
Hi, thanks for the diff. I agree that it would be preferable to run the tests from root rather than the test directory, and I see no problem with an extra __init__.py
file. I'm currently preparing a 4.0 release so I'll merge the change into that branch. Cheers.
Changed my mind and created a stable branch to do what main was previously doing, so can now merge to main directly!
Thank you! I'll add the __init__.py
I removed (in an iteration based on earlier feedback) in a new PR that you can choose to merge or not at your preference.
The nixpkgs package manager builds many Python projects and expects that projects using unittest can run the unittest command from the root dir.
The only changes that are needed to do this is to use absolute paths for files in tests relative to the current test file's path.
I hope that this is not too burdensome on maintenance for this project.