Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for testing unmanaged models #270

Closed
wants to merge 2 commits into from

Conversation

ojake
Copy link

@ojake ojake commented Sep 24, 2015

As per #264.
This is marker pytest.mark.django_use_model that allows testing of models that have Meta.managed = False

@ojake
Copy link
Author

ojake commented Sep 25, 2015

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.

Here's an example of "passing" test
https://github.com/ojake/pytest-django/blob/bug-no-test/tests/test_database.py#L190

@ojake ojake closed this Sep 25, 2015
@blueyed
Copy link
Contributor

blueyed commented Sep 25, 2015

Let's keep the PR open..
I currently don't have time to look into it, but we'll come to it.

@blueyed blueyed reopened this Sep 25, 2015
@ojake
Copy link
Author

ojake commented Sep 25, 2015

Thanks!

@timb07
Copy link

timb07 commented Jan 28, 2016

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
@blueyed
Copy link
Contributor

blueyed commented Oct 28, 2017

Closing this in favor of #310.

@blueyed blueyed closed this Oct 28, 2017
timb07 added a commit to timb07/pytest-django that referenced this pull request May 26, 2018
timb07 added a commit to timb07/pytest-django that referenced this pull request May 26, 2018
Numerico added a commit to Numerico/pytest-django that referenced this pull request Jun 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants