-
-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor and add tests #222
Conversation
Leave the extra text to the caller (main)
There's no reason to have main directly construct the URL. A different VCS (such as GitLab) could have a different URL construction. Further, in the case of LocalClient, there is no URL.
This is really just a dummy operation so that main can unconditionally make the call on any client
Add additional, non-default, Dockerfile target which installs app into an ubuntu image. This is useful for local development and enables other operations (such as committing back to the repo) to occur within the container.
Enables adding type checking to minimize mypy errors
New unittest file consists of two tests. Both run mypy, but one does so with arguments that are expected to allow the test to pass. The other does not provide those arguments and is expected to fail. The expected failure is intentional, to serve as an ongoing reminder to try to 1) move towards having strict typing in the codebase and to 2) not add any additional errors/warnings in the meantime. Separated requirements into runtime (requirements.txt) and additional development (requirements-dev.txt). Modified devcontainer and workflow to reflect the change.
This is awesome. Thanks very much for the effort. I'll take a look over it shortly! |
In particular, please pay attention to how this is working for GitHub Actions. Since I'm focused on GitLab, I'm not testing the GitHub side of it all. I'm not even sure how to! So I'm definitely relying on you and any existing regression tests to make sure that side of it is still working properly. (You can probably take that as a general note as I continue to submit new PRs.) Thanks again! |
All looks good, thanks again. About the update to the Dockerfile; what's the purpose of the additional stage? Just wondering if it'll slow things down. |
That's a fair concern, but with modern Docker it's not an issue. It used to be that it would build all stages, but these days it's smart enough to skip the new stage I introduced because it can see that the final (unnamed) stage doesn't rely on it.
As to why I introduced it, it's needed for GitLab CI/CD. Independent of that, I've also found it useful for local testing prior to a push.
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Alastair Mooney ***@***.***>
Sent: Monday, November 4, 2024 7:05:36 AM
To: alstr/todo-to-issue-action ***@***.***>
Cc: Robert Alonso ***@***.***>; Author ***@***.***>
Subject: Re: [alstr/todo-to-issue-action] refactor and add tests (PR #222)
Caution: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
All looks good, thanks again. About the update to the Dockerfile; what's the purpose of the additional stage? Just wondering if it'll slow things down.
—
Reply to this email directly, view it on GitHub<#222 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AEFHTTIK4HW7MNGRGADUH5LZ65PIZAVCNFSM6AAAAABQYDFAXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJUGU2DAOBTGI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Thanks for that. I've merged the PR, adding a couple of other bits in the meantime:
|
I think the reason the
Yes, the check failed, but the reason was because Thankfully, it looks like you caught it and fixed it in efb8b98, so I'm probably not telling you anything you don't know. But in case you didn't realize this is what happened, I wanted to highlight it just in case there's something about your local dev environment or process that caused this error or made you overlook the merge conflict (if there was one even reported). -- EDIT: It's also worth noting that the new test I added in commit 649e5025 would've caught this too. See the log below from running it against commit 4b44510. So hopefully it's just a matter of making sure
|
Yes, you're right, as the tests ran fine when I merged this PR. I'm not sure what happened. I merged this, then #218, which was pre-refactor. I did resolve the conflicts manually and thought I fixed everything highlighted, but looks like the imports got cut out somewhere along the line. I did see the error trace from the test when I checked the action logs so that did point me in the right direction when fixing it! Anyway all seems okay now so I'll release a new version shortly. Thanks again. |
This contains some additional minor refactoring and adds another unittest file.
refactor-related changes
The following changes were made further isolate the VCS-specific code from that in
main
.Client
base classmypy
-related changes, discussed belowMANUAL_COMMIT_REF
andMANUAL_BASE_REF
environment variables within *Client
so that diff URL can be VCS-specificLocalClient
, there is no URL, but parsing these variables allows it to callgit diff
with the proper argumentsClient:get_issue_url()
returns just the URL string (when applicable), rather than prefixing it with "Issue URL: ". This allows the function to be used more generically.more thorough testing
In addition, per this discussion in PR #217, I added an additional test file which uses
mypy
to look for additional errors that weren't being caught before.mypy
is really intended for layering static typing on top of Python. That's a nice goal, but I've limited the changes here to most just focus on having the additional testing without being concerned about the typing.other minor items