iamjackg / md2cf

Convert and upload Markdown documents to Confluence
MIT License
91 stars 49 forks source link

Root directory must be in pythonpath otherwise relative imports fail #93

Closed galund closed 1 year ago

galund commented 1 year ago

This PR works around a possible breaking change in recent versions of pip.

The following alternatives were considered:

  1. Pinning pip to a version that works as assumed/expected by this project. This could be done in CI (ie by making a change to ci.yml. But it wouldn't help developers trying to run the tests locally.
  2. Creating a conftest.py file in tests. This has a side-effect of ensuring the tests directory is properly imported as a module. However, while many projects won't have noticed the pip change because of having a conftest file, relying on this seems obscure.

In the end, explicitly configuring the project root to be in the pythonpath when running tests appears to be robust and sensible.

That by default pytest does not put the root directory into the pythonpath - unlike when running python -m pytest - is apparently a deliberate design choice / behaviour, albeit one that's very confusing for people not familiar with it.

iamjackg commented 1 year ago

Hah, I figured something had changed since all the CI test jobs suddenly stopped working. I already added this through another PR :) Many, many thanks for the detailed description and all the work you've done on this project.