Suite report git#107
Conversation
Test Suite Results - um - um_git/run7Suite Information
Task Information
succeeded tasks
|
Test Suite Results - lfric_apps - lfric_apps_git/run7Suite Information
Task Information
failed tasks
succeeded tasks
|
Test Suite Results - jules - jules_git/run6Suite Information
Task Information
failed tasks
succeeded tasks
|
|
Good work James Bruten (@james-bruten-mo). I've a suggestion, which should be easy to implement:
becomes
|
Sure, that looks sensible |
|
Yaswant Pradhan (@yaswant) How's this look, Test Suite Results - um - test_um_code_owners/run5Suite Information
Task Information
failed tasks
succeeded tasks
waiting tasks
|
|
Ah no, you've actively had to make it a link - I hadn't checked the markdown before. I'll try again! |
|
Ok, I think I prefer my initial attempt with 2 columns given the need to account for local sources and branch names. I have removed the git@github.com bit from the front though. Test Suite Results - um - test_um_code_owners/run5Suite Information
Task Information
failed tasks
succeeded tasks
waiting tasks
|
Co-authored-by: Yaswant Pradhan <2984440+yaswant@users.noreply.github.com>
Co-authored-by: Yaswant Pradhan <2984440+yaswant@users.noreply.github.com>
Co-authored-by: Yaswant Pradhan <2984440+yaswant@users.noreply.github.com>
|
Apparently I can't spell "dependency" |
A branch is also a reference, and local source can also be a reference. I was hoping that we could make the table a bit user friendly, e.g., I am keen to take quick look at the changes quickly. I was hoping you could implement something like: def extract_org_repo(url: str) -> str:
"""
Extract 'Org/repo' from a GitHub URL (SSH or HTTPS).
"""
match = re.search(r'github\.com[:/](.*?)(?:\.git)?$', url)
if match:
return match.group(1)
return ""and then in create_depenency_table, adjust the loop with something like: self.trac_log.extend(
create_markdown_row("Dependency", "Reference", "Main Like", header=True)
)
for dependency, data in self.dependencies.items():
ref = data["ref"] or ""
source = data["source"]
reference = source
if ".git" in source:
org_repo = extract_org_repo(source)
if bool(re.fullmatch(r"[0-9a-fA-F]{40}", ref)): # commit sha
url = f"https://github.com/{org_repo}/commit/{ref}"
reference = f"[{org_repo}@{ref[:7]}]({url})" # you can keep the full reference here if you like
else: # branch
url = f"https://github.com/{org_repo}/tree/{ref}"
reference = f"[{org_repo}@{ref}]({url})"
self.trac_log.extend(
create_markdown_row(dependency, reference, data["gitinfo"].is_main())
) |
|
Thanks Yash, that's now implemented with tweaks for being given a branch. My only other alteration is to always use the "tree" url rather than commit as only seeing the latest commit changes are probably not very useful - even when this is a branch it would only show the last commit to the branch and obviously most changes will have multiple commits. Test Suite Results - um - test_um_code_owners/run5Suite Information
Task Information
❌ failed tasks
✅ succeeded tasks
⌛ waiting tasks
|
…Scripts into suite_report_git
|
Nice! just added some fancy emojis to task details in your comment section (for idea). Also I think its better to keep the tasks left-aligned? |
|
Yash asked about exposing full hostname:paths so rather than do that, if the source is local, it will extract the remote and reference and provide a URL to that tree. If a dev has changed the local clone to something else while the test suite has run, the source displayed in the trac.log will be wrong, but I don't think it's worth worrying about that too much. I think we should recommend adding a branch or hash in the dependencies file, even when running from a local clone to help prevent this (it could be an issue for builds etc. if they change it too fast). Have also added emojis and made it left aligned Test Suite Results - um - test_um_code_owners/run5Suite Information
Task Information
❌ failed tasks 20
✅ succeeded tasks 350
⌛ waiting tasks 1
|
|
Another change moving the task counts to the dropdown summary, and setting failed as closed by default Test Suite Results - um - test_um_code_owners/run5Suite Information
Task Information❌ failed tasks - 20
✅ succeeded tasks - 350
⌛ waiting tasks - 1
|
Yaswant Pradhan (yaswant)
left a comment
There was a problem hiding this comment.
Looks good
Sam Clarke-Green (t00sa)
left a comment
There was a problem hiding this comment.
Nothing fundamental, but a few things that would benefit from a bit of a polish
| data[state].append(task) | ||
| return data | ||
|
|
||
| def populate_gitbdiff(self): |
There was a problem hiding this comment.
Needs a return type?
| repo=self.temp_directory / dependency, parent=parent | ||
| ).files() | ||
|
|
||
| def populate_gitinfo(self): |
There was a problem hiding this comment.
Needs a return type?
| suite_report = SuiteReport(args.suite_path) | ||
|
|
||
| suite_report.create_log() | ||
|
|
||
| suite_report.write_log(args.log_path) | ||
|
|
||
| suite_report.cleanup() |
There was a problem hiding this comment.
This would benefit from a finally to ensure the temporary files are always cleaned up:
| suite_report = SuiteReport(args.suite_path) | |
| suite_report.create_log() | |
| suite_report.write_log(args.log_path) | |
| suite_report.cleanup() | |
| try: | |
| suite_report = SuiteReport(args.suite_path) | |
| suite_report.create_log() | |
| suite_report.write_log(args.log_path) | |
| finally: | |
| suite_report.cleanup() |
| if not shell and type(command) != list: | ||
| command = command.split() |
There was a problem hiding this comment.
This is probably better as:
| if not shell and type(command) != list: | |
| command = command.split() | |
| if not shell and isinstance(command, str): | |
| command = command.split() |
| except ImportError: | ||
| raise ImportError( | ||
| "Unable to import from git_bdiff module. This is included in the same " | ||
| "repository as this script and included with a relative import. Ensure " | ||
| "this script is being called from the correct place." | ||
| ) |
There was a problem hiding this comment.
| except ImportError: | |
| raise ImportError( | |
| "Unable to import from git_bdiff module. This is included in the same " | |
| "repository as this script and included with a relative import. Ensure " | |
| "this script is being called from the correct place." | |
| ) | |
| except ImportError as err: | |
| raise ImportError( | |
| "Unable to import from git_bdiff module. This is included in the same " | |
| "repository as this script and included with a relative import. Ensure " | |
| "this script is being called from the correct place." | |
| ) from err |
…Scripts into suite_report_git
James Bruten (james-bruten-mo)
left a comment
There was a problem hiding this comment.
Ugh, do the standards suggest None's should be labelled as a return type?
All your comments addressed and the output rechecked. Cheers
Sam Clarke-Green (t00sa)
left a comment
There was a problem hiding this comment.
Looks good. I've suggested an init method that sets default values for the instance attributes. It's not necessary but it's good practice - and I think some of the linters grumble if you try to use something you haven't declared in the initialiser
Co-authored-by: Sam Clarke-Green <74185251+t00sa@users.noreply.github.com>
Sam Clarke-Green (t00sa)
left a comment
There was a problem hiding this comment.
Thanks, all looks good to go!
Description
Summary
Add a new version of suite_report to create a test suite summary using git sources and outputting markdown. This is a new script but does take some cues from the old one. I'll comment a couple of examples that were created by the Apps and UM test suite git migration branches.
It's currently missing unit tests, the UM Code/Config approval functionality and any checking of uncommitted changes. I'll look to add these in subsequent prs, but this will get too big if I carry on now!
This is blocked by #106 - the changes to git_bdiff were copied from there.
Checklist