Conditions | 6 |
Total Lines | 90 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | from datetime import date |
||
41 | @responses.activate |
||
42 | def test_publish( |
||
43 | capsys, |
||
44 | configured, |
||
45 | answer_prompts, |
||
46 | ): |
||
47 | |||
48 | github_merge_commit(111) |
||
49 | responses.add( |
||
50 | responses.GET, |
||
51 | ISSUE_URL.format('111'), |
||
52 | json=PULL_REQUEST_JSON, |
||
53 | status=200, |
||
54 | content_type='application/json' |
||
55 | ) |
||
56 | responses.add( |
||
57 | responses.GET, |
||
58 | LABEL_URL, |
||
59 | json=BUG_LABEL_JSON, |
||
60 | status=200, |
||
61 | content_type='application/json' |
||
62 | ) |
||
63 | responses.add( |
||
64 | responses.POST, |
||
65 | RELEASES_URL, |
||
66 | json={'upload_url': 'foo'}, |
||
67 | status=200, |
||
68 | content_type='application/json' |
||
69 | ) |
||
70 | |||
71 | init.init() |
||
72 | stage.stage( |
||
73 | draft=False, |
||
74 | release_name='Icarus', |
||
75 | release_description='The first flight' |
||
76 | ) |
||
77 | publish.publish() |
||
78 | |||
79 | release_notes_path = Path('docs').joinpath('releases').joinpath('0.0.2.md') |
||
80 | |||
81 | pre = textwrap.dedent( |
||
82 | """\ |
||
83 | Staging [fix] release for version 0.0.2... |
||
84 | Running: bumpversion --verbose --allow-dirty --no-commit --no-tag patch... |
||
85 | Generating Release... |
||
86 | Writing release notes to {release_notes_path}... |
||
87 | Publishing release 0.0.2... |
||
88 | Running: git add version.txt .bumpversion.cfg {release_notes_path}... |
||
89 | Running: git commit --message="# 0.0.2 ({release_date}) Icarus |
||
90 | """.format( |
||
91 | release_notes_path=release_notes_path, |
||
92 | release_date=date.today().isoformat(), |
||
93 | ) |
||
94 | ).splitlines() |
||
95 | |||
96 | expected_release_notes_content = [ |
||
97 | 'The first flight', |
||
98 | '## Bug', |
||
99 | ' ', |
||
100 | '* #111 The title of the pull request', |
||
101 | ' ', |
||
102 | ] |
||
103 | |||
104 | post = textwrap.dedent( |
||
105 | """\ |
||
106 | "... |
||
107 | Running: git tag 0.0.2... |
||
108 | Running: git push --tags... |
||
109 | Creating GitHub Release... |
||
110 | Published release 0.0.2... |
||
111 | """ |
||
112 | ).splitlines() |
||
113 | |||
114 | out, _ = capsys.readouterr() |
||
115 | |||
116 | assert pre + expected_release_notes_content + post == out.splitlines() |
||
117 | |||
118 | last_commit = git(shlex.split('show --name-only')) |
||
119 | expected_files = [ |
||
120 | 'version.txt', |
||
121 | '.bumpversion.cfg', |
||
122 | release_notes_path, |
||
123 | ] |
||
124 | assert [ |
||
125 | expected_file |
||
126 | for expected_file in expected_files |
||
127 | if str(expected_file) in last_commit |
||
128 | ] |
||
129 | |||
130 | assert '0.0.2' in git(shlex.split('tag --list')) |
||
131 |
This can be caused by one of the following:
1. Missing Dependencies
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
2. Missing __init__.py files
This error could also result from missing
__init__.py
files in your module folders. Make sure that you place one file in each sub-folder.