Skip to content

Commit 42eaf4d

Browse files
pyup-botrenzon
authored andcommitted
Update pytest from 3.10.0 to 4.0.1
1 parent b08f9b8 commit 42eaf4d

File tree

8 files changed

+49
-11
lines changed

8 files changed

+49
-11
lines changed

pythonpro/core/tests/test_view_edit_email.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

1111
@pytest.fixture
1212
def resp(client: Client):
13+
return _resp(client)
14+
15+
16+
def _resp(client: Client):
17+
"""Plain function to avoid _pytest.warning_types.RemovedInPytest4Warning: Fixture "resp" called directly."""
1318
return client.get(reverse('core:profile_email'), secure=True)
1419

1520

@@ -22,7 +27,7 @@ def user(django_user_model):
2227
@pytest.fixture
2328
def resp_with_user(user, client: Client):
2429
client.force_login(user)
25-
return resp(client)
30+
return _resp(client)
2631

2732

2833
def test_not_logged_user(resp):

pythonpro/core/tests/test_view_edit_name.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
@pytest.fixture
1010
def resp(client: Client):
11+
return _resp(client)
12+
13+
14+
def _resp(client):
15+
"""Plain function to avoid _pytest.warning_types.RemovedInPytest4Warning: Fixture "resp" called directly."""
1116
return client.get(reverse('core:profile_name'), secure=True)
1217

1318

@@ -20,7 +25,7 @@ def user(django_user_model):
2025
@pytest.fixture
2126
def resp_with_user(user, client: Client):
2227
client.force_login(user)
23-
return resp(client)
28+
return _resp(client)
2429

2530

2631
def test_not_logged_user(resp):

pythonpro/core/tests/test_view_edit_password.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
@pytest.fixture
1111
def resp(client: Client):
12+
return _resp(client)
13+
14+
15+
def _resp(client):
16+
"""Plain function to avoid _pytest.warning_types.RemovedInPytest4Warning: Fixture "resp" called directly."""
1217
return client.get(reverse('core:profile_password'), secure=True)
1318

1419

@@ -21,7 +26,7 @@ def user(django_user_model):
2126
@pytest.fixture
2227
def resp_with_user(user, client: Client):
2328
client.force_login(user)
24-
return resp(client)
29+
return _resp(client)
2530

2631

2732
def test_not_logged_user(resp):

pythonpro/core/tests/test_view_home.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,19 @@
1111

1212
@pytest.fixture
1313
def home_resp(client):
14+
return _resp(client)
15+
16+
17+
def _resp(client):
18+
"""Plain function to avoid _pytest.warning_types.RemovedInPytest4Warning: Fixture "resp" called directly."""
1419
return client.get('/', secure=True)
1520

1621

1722
@pytest.fixture
1823
def home_resp_with_user(django_user_model, client: Client):
1924
user = mommy.make(django_user_model)
2025
client.force_login(user)
21-
return home_resp(client)
26+
return _resp(client)
2227

2328

2429
def test_home_status_code(home_resp):
@@ -78,7 +83,7 @@ def test_forum_tab_is_present(home_resp_with_user):
7883
@pytest.fixture
7984
def home_resp_open_subscriptions(settings, client):
8085
settings.SUBSCRIPTIONS_OPEN = True
81-
return home_resp(client)
86+
return _resp(client)
8287

8388

8489
def test_payment_link_is_present(home_resp_open_subscriptions):
@@ -91,7 +96,7 @@ def test_payment_link_is_present(home_resp_open_subscriptions):
9196
@pytest.fixture
9297
def home_resp_closed_subscriptions(settings, client):
9398
settings.SUBSCRIPTIONS_OPEN = False
94-
return home_resp(client)
99+
return _resp(client)
95100

96101

97102
def test_payment_link_is_not_present(home_resp_closed_subscriptions):

pythonpro/core/tests/test_view_profile.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
@pytest.fixture
1010
def resp(client: Client):
11+
return _resp(client)
12+
13+
14+
def _resp(client):
15+
"""Plain function to avoid _pytest.warning_types.RemovedInPytest4Warning: Fixture "resp" called directly."""
1116
return client.get(reverse('core:profile'), secure=True)
1217

1318

@@ -20,7 +25,7 @@ def user(django_user_model):
2025
@pytest.fixture
2126
def resp_with_user(user, client: Client):
2227
client.force_login(user)
23-
return resp(client)
28+
return _resp(client)
2429

2530

2631
def test_profile_not_logged_user(resp):

pythonpro/discourse/tests/test_sso.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def client_with_user(client, logged_user):
4040

4141
@pytest.fixture
4242
def response(client_with_user, payload, sig=None):
43+
return _resp(client_with_user, payload, sig)
44+
45+
46+
def _resp(client_with_user, payload, sig=None):
4347
encoded_payload = base64.encodebytes(payload.encode('utf-8'))
4448
hmac_obj = hmac.new(settings.DISCOURSE_SSO_SECRET.encode('utf-8'), encoded_payload, digestmod=hashlib.sha256)
4549
sig = hmac_obj.hexdigest() if sig is None else sig
@@ -49,12 +53,12 @@ def response(client_with_user, payload, sig=None):
4953

5054
@pytest.fixture
5155
def response_with_wrong_sig(client_with_user, payload):
52-
return response(client_with_user, payload, 'wrong sinature')
56+
return _resp(client_with_user, payload, 'wrong sinature')
5357

5458

5559
@pytest.fixture
5660
def response_without_nonce(client_with_user):
57-
return response(client_with_user, '')
61+
return _resp(client_with_user, '')
5862

5963

6064
def _extract_from_payload(response):

pythonpro/modules/tests/test_module_detail_view.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ def python_birds(modules):
8080

8181
@pytest.fixture
8282
def resp_with_sections(client_with_user, sections, python_birds):
83+
return _resp_with_sections(client_with_user, sections, python_birds)
84+
85+
86+
def _resp_with_sections(client_with_user, sections, python_birds):
87+
"""Plain function to avoid _pytest.warning_types.RemovedInPytest4Warning: Fixture "resp" called directly."""
8388
return client_with_user.get(reverse('modules:detail', kwargs={'slug': python_birds.slug}))
8489

8590

@@ -103,7 +108,7 @@ def chapters(sections):
103108

104109
@pytest.fixture
105110
def resp_with_chapters(client_with_user, python_birds, sections, chapters):
106-
return resp_with_sections(client_with_user, sections, python_birds)
111+
return _resp_with_sections(client_with_user, sections, python_birds)
107112

108113

109114
def test_chapter_titles(resp_with_chapters, chapters):

pythonpro/modules/tests/test_module_index_view.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ def modules(transactional_db):
1818
def resp(client, django_user_model, modules):
1919
user = mommy.make(django_user_model)
2020
client.force_login(user)
21-
return resp_not_logged(client, modules)
21+
return _resp_not_logged(client, modules)
2222

2323

2424
@pytest.fixture
2525
def resp_not_logged(client, modules):
26+
return _resp_not_logged(client, modules)
27+
28+
29+
def _resp_not_logged(client, modules):
2630
return client.get(reverse('modules:index'))
2731

2832

0 commit comments

Comments
 (0)