pytest-django
pytest-django copied to clipboard
Early "python-paths" setting?
I know about the pytest-python path plugin, but I'd like much earlier pythonpaths to be setup by pytest-django, so that it can find my early hook (which applies patches before django.setup()).
It looks like a simpler solution, for now, than making the "django.setup()" call configurable in pytest conf. In an early hook (before conftest.py files search and django;setup() loading), uers have all power to customize environment as they please, including replacing django.setup by something else..
Does it sound right that I attempt a PR on a setting like "python_paths_early = your/path/apps your/path/libs"? Or am I missing some aspects of the architecture?
I've opened a PR for a first look at how it might look: https://github.com/pytest-dev/pytest-django/pull/768
I've updated the PR to latest master (https://github.com/pytest-dev/pytest-django/pull/768)
pytest-pythonpaths loads paths as early as it can, but even that doesn't work for my needs actually: the "-p" option of Pytest is loaded veryyyyy early in the pytest workflow, so I don't get a chance to modify pythonpath so that it can load my custom plugin (used to patch django.setup() before pytest-django does it).
So it seems the proper way to go would be new pytest-django settings to customize the setup step, as proposed in issue #723