Resolve circular dependency between foris-controller and foris-controller-testtools
There is circular dependency between foris-controller
and foris-controller-testtools
:
- https://gitlab.nic.cz/turris/foris-controller/foris-controller/-/blob/master/setup.py#L137-139
- https://gitlab.nic.cz/turris/foris-controller/foris-controller-testtools/-/blob/master/setup.py#L45-47
- https://gitlab.nic.cz/turris/foris-controller/foris-controller-testtools/-/blob/master/foris_controller_testtools/utils.py#L48
- https://gitlab.nic.cz/turris/foris-controller/foris-controller-testtools/-/blob/master/foris_controller_testtools/utils.py#L54
- https://gitlab.nic.cz/turris/foris-controller/foris-controller-testtools/-/blob/master/foris_controller_testtools/fixtures.py#L356
Which works fine most of the time, i.e. when foris-controller requires latest testtools and vice versa.
foris-controller[master] -> foris-controller-testtools[master] -> foris-controller[master]
But it breaks when using development branches, for instance:
foris-controller/setup.py
foris-controller-testtools @ git+https://gitlab.nic.cz/turris/foris-controller/foris-controller-testtools.git@feature/my-awesome-feature
foris-controller-testtools/setup.py
foris-controller @ git+https://gitlab.nic.cz/turris/foris-controller/foris-controller.git # basically master branch
Pip then fails with dependency conflict:
INFO: pip is looking at multiple versions of foris-controller to determine which version is compatible with other requirements. This could take a while.
The conflict is caused by:
The user requested turrishw 0.12.0 (from git+https://gitlab.nic.cz/turris/turrishw.git@v0.12.0)
foris-controller 5.5.2 depends on turrishw 0.10.0 (from git+https://gitlab.nic.cz/turris/turrishw.git@v0.10.0#egg=turrishw)
Workaround
This could be circumvented by setting circular dependency:
foris-controller[dev] -> foris-controller-testtools[dev] -> foris-controller[dev]
But that has to be removed before merging changes to both foris-controller and foris-controller-testtools.
Proposed solution
Ideally testtools would be just an addon for testing and dependencies would look like:
foris-controller -> foris-controller-testtools
But in this case, foris-controller parts (app, message buses, etc.) would have to be somehow injected into the testtools at runtime.