You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok, there is something weird going on. Looks like tests marked with django_use_model are not even executed. I discovered it when trying to use it with coverage.
I'm going to try to figure this out, but I would appreciate some help, because I clearly don't understand how pytest-django works.
Hi. I don't understand py.test well enough to work out why @pytest.mark.django_use_model(Unmanaged)
causes the test not to be collected, but I have found a way that does work.
Mark with: @pytest.mark.django_use_model(model=Unmanaged)
And then in _django_use_model(), fetch the model(s) like this: model = marker.kwargs['model']
instead of using request.getfuncargvalue().
timb07
added a commit
to timb07/pytest-django
that referenced
this pull request
Jan 29, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
As per #264.
This is marker pytest.mark.django_use_model that allows testing of models that have
Meta.managed = False