Skip to content

Commit 3519b63

Browse files
Pylint fix 'missing-function-docstring', 'missing-class-docstring'. #37 Remove unnecessary pylint job 'Pylint Hard'. Remove pylint-exit from Pylint job.
1 parent ee54096 commit 3519b63

File tree

11 files changed

+35
-9
lines changed

11 files changed

+35
-9
lines changed

.gitlab/linter.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Pylint:
1414
allow_failure: true
1515
extends: .linter_template
1616
script:
17-
- pylint --rcfile=pylintrc $PWD | tee ./pylint/pylint.log || pylint-exit $?; rm __init__.py
17+
- pylint --rcfile=pylintrc $PWD | tee ./pylint/pylint.log
1818
after_script:
1919
- PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' ./pylint/pylint.log)
2020
- echo $PYLINT_SCORE
@@ -26,11 +26,6 @@ Pylint:
2626
paths:
2727
- ./pylint/
2828

29-
Pylint Hard:
30-
extends: .linter_template
31-
script:
32-
- pylint --rcfile=pylintrc $PWD --disable=missing-function-docstring,missing-class-docstring
33-
3429
#Quality Control:
3530
# allow_failure: false
3631
# stage: Merge Request

src/main/session.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88

99

1010
class ApiSession(Session):
11+
"""Requests api session which Log request/response to allure attachments and console."""
1112

1213
@allure_request_logger
1314
def request(self, method, url, **kwargs) -> Response:
14-
""" Log request/response to allure and info"""
15-
1615
response = super().request(method=method, url=url, **kwargs)
1716

1817
return response
1918

2019

2120
class HttpbinApiSessionLevelOne(Session):
21+
"""Requests api session which has hardcoded base_url."""
2222

2323
def request(self, method, url, **kwargs) -> Response:
2424
url = f'https://httpbin.org{url}'
@@ -27,6 +27,8 @@ def request(self, method, url, **kwargs) -> Response:
2727

2828

2929
class HttpbinApiSessionLevelTwo(Session):
30+
"""Requests api session which has hardcoded base_url.
31+
And logs request/response into allure attachments."""
3032

3133
def request(self, method, url, **kwargs) -> Response:
3234
url = f'https://httpbin.org{url}'

src/test/moretv/__init__.py

Whitespace-only changes.

src/test/moretv/main_page/__init__.py

Whitespace-only changes.

src/test/old_ctc/__init__.py

Whitespace-only changes.

src/test/old_ctc/tvprogram/__init__.py

Whitespace-only changes.

src/test/old_ctc/tvprogram/test_weeks_slider.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77

88
def test_current_week_is_active(browser_module):
9+
"""Assert that /programm page opens tv-program schedule on current week."""
910
logging.info('step1/2: start')
1011
browser_module.open('https://ctc.ru/programm')
1112
logging.info('step1/2: finish')
@@ -15,6 +16,7 @@ def test_current_week_is_active(browser_module):
1516

1617

1718
def test_current_week_has_words_in_days(browser_module):
19+
"""Assert that /program page current week slider has week as weekdays names."""
1820
logging.info('step1/2: start')
1921
browser_module.open('https://ctc.ru/programm')
2022
logging.info('step1/2: finish')
@@ -25,6 +27,7 @@ def test_current_week_has_words_in_days(browser_module):
2527

2628

2729
def test_today_is_active(browser_module):
30+
"""Assert that /programm page opens tv-schedule on today."""
2831
logging.info('step1/2: start')
2932
browser_module.open('https://ctc.ru/programm')
3033
logging.info('step1/2: finish')

src/test/test_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# pylint: disable=missing-function-docstring
12
import json
23
import os
34

src/test/test_assertions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# pylint: disable=global-statement
1+
# pylint: disable=global-statement,missing-function-docstring
22
import contextlib
33

44
from pytest_voluptuous import S

src/test/test_duplicates.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@
2121

2222
def test_list_of_dictionaries_does_not_duplicate_by_some_key_value():
2323
"""
24+
2425
1. create new dict with global keys by some key value which could repeat in list of dictionaries
2526
and append to this key a list of dictionaries, where this value figure
2627
2. assert that dictionaries does not duplicate by some key's value
28+
2729
"""
30+
2831
new_some_view = defaultdict(list)
2932

3033
for some in SOMETHING:
@@ -42,6 +45,16 @@ def test_list_of_dictionaries_does_not_duplicate_by_some_key_value():
4245
Random().randints(20, 0, 10),
4346
])
4447
def test_list_doesnt_have_duplicates(some_list):
48+
"""Parametrized test asserts there is no duplicate ints in list.
49+
50+
Using next features:
51+
1. Random() function;
52+
2. Sorting set;
53+
3. Sorting list;
54+
4. List comprehension;
55+
56+
"""
57+
4558
some_list.sort()
4659
logging.info(some_list)
4760

@@ -53,20 +66,30 @@ def test_list_doesnt_have_duplicates(some_list):
5366

5467

5568
def has_duplicates(list_of_values):
69+
"""Returns True if there are duplicates in list.
70+
71+
Nothing special:
72+
Simple cycle.
73+
Uses any() method to check.
74+
75+
"""
76+
5677
value_dict = defaultdict(int)
5778
for item in list_of_values:
5879
value_dict[item] += 1
5980
return any(val > 1 for val in value_dict.values())
6081

6182

6283
def test_print_not_duplicated():
84+
"""Test for method has_duplicates returns False."""
6385
list_of_values = [2, -2]
6486

6587
info(has_duplicates(list_of_values))
6688
assert has_duplicates(list_of_values) is False
6789

6890

6991
def test_print_duplicated():
92+
"""Test for method has_duplicates returns True."""
7093
list_of_values = [2, 2]
7194

7295
info(has_duplicates(list_of_values))

0 commit comments

Comments
 (0)