Improve Django Unit Test Execution Pathing #103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running neovim somewhere other than where
manage.py
is located can cause pathing issues when running tests. I think this can be improved by identifying wheremanage.py
is located, relative to the test file location.Consider the existing solution:
It will place the
cwd
of neovim into the system path, before executing the test.Given a repository such as:
and with neovim launched from top of the repository and a test being ran in
bar/tests/test_bar.py
it would result in a case_id:
that then results in an
argv
generation ofNote the prefix of
app
, which is the django project housing project in the given repository structure exampleThis would be different to what would of occured if the tests were ran with
manage.py
, because the path would start withbar
instead ofapp
.In the current solution, one way around this is to
cd
into theapp
folder, before triggeringneotest
to run the test.This pull request proposes adding a resolver to locate
manage.py
and perform relative file calculations from the location ofmanage.py
, rather than the location of neovim'scwd
@afrischk this extends your implementation, what do you think? #51