Skip to content

Commit b514bf2

Browse files
authored
Merge pull request #799 from blueyed/minor
Minor improvements
2 parents febbff4 + 8d9ab85 commit b514bf2

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

pytest_django/fixtures.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434

3535
@pytest.fixture(scope="session")
36-
def django_db_modify_db_settings_tox_suffix(request):
36+
def django_db_modify_db_settings_tox_suffix():
3737
skip_if_no_django()
3838

3939
tox_environment = os.getenv("TOX_PARALLEL_ENV")

pytest_django/plugin.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def _get_option_with_source(option, envname):
325325
_setup_django()
326326

327327

328-
def pytest_report_header(config):
328+
def pytest_report_header():
329329
if _report_header:
330330
return ["django: " + ", ".join(_report_header)]
331331

@@ -415,7 +415,7 @@ def pytest_runtest_setup(item):
415415
_disable_class_methods(item.cls)
416416

417417

418-
def pytest_collection_modifyitems(session, config, items):
418+
def pytest_collection_modifyitems(items):
419419
def get_order_number(test):
420420
marker_db = test.get_closest_marker('django_db')
421421
if marker_db:
@@ -553,7 +553,7 @@ def _dj_autoclear_mailbox():
553553

554554

555555
@pytest.fixture(scope="function")
556-
def mailoutbox(monkeypatch, django_mail_patch_dns, _dj_autoclear_mailbox):
556+
def mailoutbox(django_mail_patch_dns, _dj_autoclear_mailbox):
557557
if not django_settings_is_configured():
558558
return
559559

@@ -570,7 +570,7 @@ def django_mail_patch_dns(monkeypatch, django_mail_dnsname):
570570

571571

572572
@pytest.fixture(scope="function")
573-
def django_mail_dnsname(monkeypatch):
573+
def django_mail_dnsname():
574574
return "fake-tests.example.com"
575575

576576

@@ -605,7 +605,7 @@ def restore():
605605

606606

607607
@pytest.fixture(autouse=True, scope="session")
608-
def _fail_for_invalid_template_variable(request):
608+
def _fail_for_invalid_template_variable():
609609
"""Fixture that fails for invalid variables in templates.
610610
611611
This fixture will fail each test that uses django template rendering

tests/test_fixtures.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,12 @@ def test_serve_static_with_staticfiles_app(self, django_testdir, settings):
417417
"""
418418
django_testdir.create_test_module(
419419
"""
420-
import pytest
421420
from django.utils.encoding import force_str
422421
423422
try:
424-
from urllib2 import urlopen, HTTPError
423+
from urllib2 import urlopen
425424
except ImportError:
426-
from urllib.request import urlopen, HTTPError
425+
from urllib.request import urlopen
427426
428427
class TestLiveServer:
429428
def test_a(self, live_server, settings):

0 commit comments

Comments
 (0)