openSUSE / orthos2

Orthos is a machine administration tool.
GNU General Public License v2.0
14 stars 13 forks source link

Fixup Django Tests #212

Closed SchoolGuy closed 1 year ago

SchoolGuy commented 1 year ago

This PR fixes up the code of the application and the tests so the CI is finally green.

Splitout PRs:

SchoolGuy commented 1 year ago

@watologo1 Obviously the Git history needs to be extended with information and cleaned beforehand but the content of the PR is done. If your review is positive I would clean and extend the Git History. Please DON'T merge if you approve this PR!

SchoolGuy commented 1 year ago

After double checking the built RPM, I now see that the templates are missing in it. I need to adjust the setup.py to include the templates.

Edit: Basedir Templates removal

SchoolGuy commented 1 year ago

There is a structural problem with pip. They require that all package data is contained inside the package the package (Source). This means that on a pip install . all the files that are listed under data_files is not being installed. The legacy way (python3 setup.py install) is working just fine.

If one trusts Stackoverflow then there is also a second source for this behavior: https://stackoverflow.com/q/42791179/4730773

The "correct" way to satisfy both the old and new way of packaging would be to use a data folder inside the package (Source) and have a command that copies the files over. The command that copies the files over would be then executed during the %install stage in the specfile.

The problem described here is also present in Cobbler. However, I think moving everything into <Project Root>/orthos2 is stupid. I will need to research further how this is supposed to work as we need a solution for both production and development that works identically.

Edit: Good writeup about this problem can be found here as well - https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853

SchoolGuy commented 1 year ago

After a discussion with @watologo1 I decided that this PR is too big and still has problems to be solved. The mentioned problems are not in the scope of this PR though. As such I will start creating splitout PRs.

SchoolGuy commented 1 year ago

@watologo1 I tried to address all your concerns. I would kindly ask you to re-review this now much smaller Pull Request.