-
Notifications
You must be signed in to change notification settings - Fork 342
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
#596 MarkInfo deprecation #603
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ _build | |
/.coverage | ||
/htmlcov/ | ||
.cache | ||
.pytest_cache/ | ||
.Python | ||
.eggs | ||
*.egg |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -378,10 +378,10 @@ def _django_db_marker(request): | |
This will dynamically request the ``db`` or ``transactional_db`` | ||
fixtures as required by the django_db marker. | ||
""" | ||
marker = request.keywords.get('django_db', None) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The two places like this bump the requirements to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I think requiring pytest 3.6 is fine. |
||
marker = request.node.get_closest_marker('django_db') | ||
if marker: | ||
validate_django_db(marker) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not 100% happy with the naming, but I didn't think of anything better. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What naming do you mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking |
||
if marker.transaction: | ||
transaction = validate_django_db(marker) | ||
if transaction: | ||
getfixturevalue(request, 'transactional_db') | ||
else: | ||
getfixturevalue(request, 'db') | ||
|
@@ -447,7 +447,7 @@ def mailoutbox(monkeypatch, _dj_autoclear_mailbox): | |
@pytest.fixture(autouse=True, scope='function') | ||
def _django_set_urlconf(request): | ||
"""Apply the @pytest.mark.urls marker, internal to pytest-django.""" | ||
marker = request.keywords.get('urls', None) | ||
marker = request.node.get_closest_marker('urls') | ||
if marker: | ||
skip_if_no_django() | ||
import django.conf | ||
|
@@ -457,9 +457,9 @@ def _django_set_urlconf(request): | |
# Removed in Django 2.0 | ||
from django.core.urlresolvers import clear_url_caches, set_urlconf | ||
|
||
validate_urls(marker) | ||
urls = validate_urls(marker) | ||
original_urlconf = django.conf.settings.ROOT_URLCONF | ||
django.conf.settings.ROOT_URLCONF = marker.urls | ||
django.conf.settings.ROOT_URLCONF = urls | ||
clear_url_caches() | ||
set_urlconf(None) | ||
|
||
|
@@ -656,8 +656,8 @@ def validate_django_db(marker): | |
the marker which will have the correct value. | ||
""" | ||
def apifun(transaction=False): | ||
marker.transaction = transaction | ||
apifun(*marker.args, **marker.kwargs) | ||
return transaction | ||
return apifun(*marker.args, **marker.kwargs) | ||
|
||
|
||
def validate_urls(marker): | ||
|
@@ -667,5 +667,5 @@ def validate_urls(marker): | |
marker which will have the correct value. | ||
""" | ||
def apifun(urls): | ||
marker.urls = urls | ||
apifun(*marker.args, **marker.kwargs) | ||
return urls | ||
return apifun(*marker.args, **marker.kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was missing, so added it in a separate commit.