|
1
|
|
|
import textwrap |
|
2
|
|
|
|
|
3
|
|
|
import responses |
|
|
|
|
|
|
4
|
|
|
from plumbum.cmd import git |
|
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
from changes.commands import status |
|
7
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
def test_status( |
|
10
|
|
|
capsys, |
|
11
|
|
|
git_repo_with_merge_commit, |
|
12
|
|
|
with_auth_token_envvar |
|
13
|
|
|
): |
|
14
|
|
|
|
|
15
|
|
|
git('tag', '0.0.2') |
|
16
|
|
|
|
|
17
|
|
|
status.status() |
|
18
|
|
|
|
|
19
|
|
|
expected_output = textwrap.dedent( |
|
20
|
|
|
"""\ |
|
21
|
|
|
Indexing repository... |
|
22
|
|
|
Looking for Github Auth Token in the environment... |
|
23
|
|
|
Found Github Auth Token in the environment... |
|
24
|
|
|
Repository: michaeljoseph/test_app... |
|
25
|
|
|
Latest Version... |
|
26
|
|
|
0.0.2 |
|
27
|
|
|
Changes... |
|
28
|
|
|
0 changes found since 0.0.2 |
|
29
|
|
|
""" |
|
30
|
|
|
) |
|
31
|
|
|
out, _ = capsys.readouterr() |
|
32
|
|
|
assert expected_output == out |
|
33
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
@responses.activate |
|
36
|
|
|
def test_status_with_changes( |
|
37
|
|
|
capsys, |
|
38
|
|
|
git_repo_with_merge_commit, |
|
39
|
|
|
with_auth_token_envvar |
|
40
|
|
|
): |
|
41
|
|
|
|
|
42
|
|
|
from .conftest import github_merge_commit, ISSUE_URL |
|
43
|
|
|
|
|
44
|
|
|
git('tag', '0.0.2') |
|
45
|
|
|
github_merge_commit(112) |
|
46
|
|
|
|
|
47
|
|
|
responses.add( |
|
48
|
|
|
responses.GET, |
|
49
|
|
|
ISSUE_URL.format('112'), |
|
50
|
|
|
json={ |
|
51
|
|
|
'number': 112, |
|
52
|
|
|
'title': 'The title of the pull request', |
|
53
|
|
|
'body': 'An optional, longer description.', |
|
54
|
|
|
'user': { |
|
55
|
|
|
'login': 'someone' |
|
56
|
|
|
}, |
|
57
|
|
|
'labels': [ |
|
58
|
|
|
{'id': 1, 'name': 'bug'} |
|
59
|
|
|
], |
|
60
|
|
|
}, |
|
61
|
|
|
status=200, |
|
62
|
|
|
content_type='application/json' |
|
63
|
|
|
) |
|
64
|
|
|
|
|
65
|
|
|
status.status() |
|
66
|
|
|
|
|
67
|
|
|
expected_output = textwrap.dedent( |
|
68
|
|
|
"""\ |
|
69
|
|
|
Indexing repository... |
|
70
|
|
|
Looking for Github Auth Token in the environment... |
|
71
|
|
|
Found Github Auth Token in the environment... |
|
72
|
|
|
Repository: michaeljoseph/test_app... |
|
73
|
|
|
Latest Version... |
|
74
|
|
|
0.0.2 |
|
75
|
|
|
Changes... |
|
76
|
|
|
1 changes found since 0.0.2 |
|
77
|
|
|
#112 The title of the pull request by @someone [bug] |
|
78
|
|
|
Computed release type fix from changes issue tags... |
|
79
|
|
|
Proposed version bump 0.0.2 => 0.0.3... |
|
80
|
|
|
""" |
|
81
|
|
|
) |
|
82
|
|
|
out, _ = capsys.readouterr() |
|
83
|
|
|
assert expected_output == out |
|
84
|
|
|
|
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__.pyfiles in your module folders. Make sure that you place one file in each sub-folder.