Skip to content

Commit fa4b5e7

Browse files
Fix tests (#139)
1 parent 049edbb commit fa4b5e7

File tree

4 files changed

+39
-37
lines changed

4 files changed

+39
-37
lines changed

.github/workflows/smoke-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ jobs:
9090
else
9191
echo "::error::Header is invalid for ${{ matrix.args }}"
9292
echo "Expected: $HEADER"
93-
echo "Actual: $FIRST_LINE"
93+
echo "Actual: $FIRST_LINE"
9494
exit 1
9595
fi

commits_parser.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
class CommitData:
1515
repository_name: str = ''
1616
author_name: str = ''
17+
author_login: str = ''
1718
author_email: str = ''
18-
datetime: str = ''
19+
date_and_time: str = ''
1920
changed_files: str = ''
2021
commit_id: str = ''
2122
branch: str = ''
@@ -51,8 +52,9 @@ def log_repository_commits(
5152
commit_data = CommitData(
5253
repository_name=repository.name,
5354
author_name=commit.author.username,
55+
author_login=commit.author.login or EMPTY_FIELD,
5456
author_email=commit.author.email or EMPTY_FIELD,
55-
datetime=commit.date.astimezone(pytz.timezone(TIMEZONE)).isoformat(),
57+
date_and_time=commit.date.astimezone(pytz.timezone(TIMEZONE)).isoformat(),
5658
changed_files=changed_files,
5759
commit_id=commit._id,
5860
branch=branch,

issues_parser.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,19 @@ class IssueData:
2323
creator_name: str = ''
2424
creator_login: str = ''
2525
creator_email: str = ''
26-
closed_at: str | None = None
2726
closer_name: str | None = None
2827
closer_login: str | None = None
2928
closer_email: str | None = None
30-
assignee_story: str = ''
31-
connected_pull_requests: str = ''
32-
labels: str = ''
33-
milestone: str = ''
34-
35-
36-
@dataclass(kw_only=True, frozen=True)
37-
class IssueDataWithComment(IssueData):
29+
closed_at: str | None = None
3830
comment_body: str = ''
3931
comment_created_at: str = ''
4032
comment_author_name: str = ''
4133
comment_author_login: str = ''
4234
comment_author_email: str = ''
35+
assignee_story: str = ''
36+
connected_pull_requests: str = ''
37+
labels: str = ''
38+
milestone: str = ''
4339

4440

4541
def get_connected_pulls(
@@ -223,13 +219,17 @@ def get_info(obj, attr):
223219
def log_issue_and_comments(csv_name, issue_data: IssueData, comments):
224220
if comments:
225221
for comment in comments:
226-
comment_data = IssueDataWithComment(
227-
**asdict(issue_data),
228-
comment_body=comment.body,
229-
comment_created_at=str(comment.created_at),
230-
comment_author_name=comment.author.username,
231-
comment_author_login=comment.author.login,
232-
comment_author_email=comment.author.email,
222+
comment_data = IssueData(
223+
**(
224+
asdict(issue_data) |
225+
dict(
226+
comment_body=comment.body,
227+
comment_created_at=str(comment.created_at),
228+
comment_author_name=comment.author.username,
229+
comment_author_login=comment.author.login,
230+
comment_author_email=comment.author.email,
231+
)
232+
)
233233
)
234234
comment_data = asdict(comment_data)
235235

@@ -248,7 +248,7 @@ def log_issues(
248248
finish: datetime,
249249
fork_flag: bool,
250250
):
251-
info = asdict(IssueDataWithComment())
251+
info = asdict(IssueData())
252252
logger.log_to_csv(csv_name, list(info.keys()))
253253

254254
for client, repo, token in binded_repos:

pull_requests_parser.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class PullRequestData:
2626
creator_login: str = ''
2727
creator_email: str = ''
2828
changed_files: str = ''
29+
comment_body: str = ''
30+
comment_created_at: str = ''
31+
comment_author_name: str = ''
32+
comment_author_login: str = ''
33+
comment_author_email: str = ''
2934
merger_name: str | None = None
3035
merger_login: str | None = None
3136
merger_email: str | None = None
@@ -37,15 +42,6 @@ class PullRequestData:
3742
milestone: str = ''
3843

3944

40-
@dataclass(kw_only=True, frozen=True)
41-
class PullRequestDataWithComment(PullRequestData):
42-
comment_body: str = ''
43-
comment_created_at: str = ''
44-
comment_author_name: str = ''
45-
comment_author_login: str = ''
46-
comment_author_email: str = ''
47-
48-
4945
def get_related_issues(pull_request_number, repo_owner, repo_name, token):
5046
# TODO как-то заменить
5147
return
@@ -164,13 +160,17 @@ def get_info(obj, attr):
164160
comments = client.get_comments(repository, pull)
165161
if comments:
166162
for comment in comments:
167-
comment_data = PullRequestDataWithComment(
168-
**asdict(pr_data),
169-
comment_body=comment.body,
170-
comment_created_at=str(comment.created_at),
171-
comment_author_name=comment.author.name,
172-
comment_author_login=comment.author.login,
173-
comment_author_email=nvl(comment.author.email),
163+
comment_data = PullRequestData(
164+
**(
165+
asdict(pr_data) |
166+
dict(
167+
comment_body=comment.body,
168+
comment_created_at=str(comment.created_at),
169+
comment_author_name=comment.author.name,
170+
comment_author_login=comment.author.login,
171+
comment_author_email=nvl(comment.author.email),
172+
)
173+
)
174174
)
175175
comment_data = asdict(comment_data)
176176

@@ -196,7 +196,7 @@ def log_pull_requests(
196196
fork_flag: bool,
197197
log_comments=False,
198198
):
199-
info = asdict(PullRequestDataWithComment())
199+
info = asdict(PullRequestData())
200200
logger.log_to_csv(csv_name, list(info.keys()))
201201

202202
for client, repo, token in binded_repos:

0 commit comments

Comments
 (0)