1
|
|
|
import textwrap |
2
|
|
|
|
3
|
|
|
import responses |
|
|
|
|
4
|
|
|
from plumbum.cmd import git |
|
|
|
|
5
|
|
|
|
6
|
|
|
from changes.commands import status |
7
|
|
|
from .conftest import github_merge_commit, ISSUE_URL, LABEL_URL |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
@responses.activate |
11
|
|
|
def test_status( |
|
|
|
|
12
|
|
|
capsys, |
13
|
|
|
git_repo, |
14
|
|
|
with_auth_token_envvar, |
15
|
|
|
changes_config_in_tmpdir, |
16
|
|
|
with_releases_directory_and_bumpversion_file_prompt, |
17
|
|
|
): |
18
|
|
|
|
19
|
|
|
responses.add( |
20
|
|
|
responses.GET, |
21
|
|
|
LABEL_URL, |
22
|
|
|
json={ |
23
|
|
|
'bug': { |
24
|
|
|
"id": 208045946, |
25
|
|
|
"url": "https://api.github.com/repos/michaeljoseph/test_app/labels/bug", |
|
|
|
|
26
|
|
|
"name": "bug", |
27
|
|
|
"color": "f29513", |
28
|
|
|
"default": True |
29
|
|
|
}, |
30
|
|
|
}, |
31
|
|
|
status=200, |
32
|
|
|
content_type='application/json' |
33
|
|
|
) |
34
|
|
|
|
35
|
|
|
status.status() |
36
|
|
|
|
37
|
|
|
expected_output = textwrap.dedent( |
38
|
|
|
"""\ |
39
|
|
|
Found Github Auth Token in the environment... |
40
|
|
|
Repository: michaeljoseph/test_app... |
41
|
|
|
Latest Version... |
42
|
|
|
0.0.1 |
43
|
|
|
Changes... |
44
|
|
|
0 changes found since 0.0.1 |
45
|
|
|
""" |
46
|
|
|
) |
47
|
|
|
out, _ = capsys.readouterr() |
48
|
|
|
assert expected_output == out |
49
|
|
|
|
50
|
|
|
# TODO:check project config |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
@responses.activate |
54
|
|
|
def test_status_with_changes( |
|
|
|
|
55
|
|
|
capsys, |
56
|
|
|
git_repo, |
57
|
|
|
with_auth_token_envvar, |
58
|
|
|
changes_config_in_tmpdir, |
59
|
|
|
with_releases_directory_and_bumpversion_file_prompt, |
60
|
|
|
): |
61
|
|
|
|
62
|
|
|
github_merge_commit(111) |
63
|
|
|
|
64
|
|
|
responses.add( |
65
|
|
|
responses.GET, |
66
|
|
|
ISSUE_URL.format('111'), |
67
|
|
|
json={ |
68
|
|
|
'number': 111, |
69
|
|
|
'title': 'The title of the pull request', |
70
|
|
|
'body': 'An optional, longer description.', |
71
|
|
|
'user': { |
72
|
|
|
'login': 'someone' |
73
|
|
|
}, |
74
|
|
|
'labels': [ |
75
|
|
|
{'id': 1, 'name': 'bug'} |
76
|
|
|
], |
77
|
|
|
}, |
78
|
|
|
status=200, |
79
|
|
|
content_type='application/json' |
80
|
|
|
) |
81
|
|
|
responses.add( |
82
|
|
|
responses.GET, |
83
|
|
|
LABEL_URL, |
84
|
|
|
json={ |
85
|
|
|
'bug': { |
86
|
|
|
"id": 208045946, |
87
|
|
|
"url": "https://api.github.com/repos/michaeljoseph/test_app/labels/bug", |
|
|
|
|
88
|
|
|
"name": "bug", |
89
|
|
|
"color": "f29513", |
90
|
|
|
"default": True |
91
|
|
|
}, |
92
|
|
|
}, |
93
|
|
|
status=200, |
94
|
|
|
content_type='application/json' |
95
|
|
|
) |
96
|
|
|
|
97
|
|
|
status.status() |
98
|
|
|
|
99
|
|
|
expected_output = textwrap.dedent( |
100
|
|
|
"""\ |
101
|
|
|
Found Github Auth Token in the environment... |
102
|
|
|
Repository: michaeljoseph/test_app... |
103
|
|
|
Latest Version... |
104
|
|
|
0.0.1 |
105
|
|
|
Changes... |
106
|
|
|
1 changes found since 0.0.1 |
107
|
|
|
#111 The title of the pull request by @someone [bug] |
108
|
|
|
Computed release type fix from changes issue tags... |
109
|
|
|
Proposed version bump 0.0.1 => 0.0.2... |
110
|
|
|
""" |
111
|
|
|
) |
112
|
|
|
out, _ = capsys.readouterr() |
113
|
|
|
assert expected_output == out |
114
|
|
|
|
115
|
|
|
# TODO:check project config |
116
|
|
|
|
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.