-
Notifications
You must be signed in to change notification settings - Fork 8
Make all tests work offline #72
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
Conversation
864e5dc to
908d36d
Compare
|
Okay, this appears to be working now, so I'm pulling it out of draft. More context: Happy to answer questions or discuss concerns. P.S. - sorry about iterating on changes in the PR like this, I know there was a lot of force-pushing. I'll try to do better in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach that you have taken is pretty impressive.
Building on the work, I feel that specifying all the repository files within the script gives little control to the user.
I am suggesting that we can use the following approach:
-
Except for all the
tar/zipandsvn/bzr/hgvcs clients, we can simply mention the temporary paths to the repositories, while giving control to the user for tagging, commit hashes, and specific branch support:# Repo URL is fixed to local path for testing purposes --- repositories: immutable/hash: type: git url: file:///vcstmp/vcs2l version: 377d5b3d03c212f015cc832fdb368f4534d0d583 immutable/tag: type: git url: file:///vcstmp/vcs2l version: tags/0.1.27 vcs2l: type: git url: file:///vcstmp/vcs2l version: heads/main without_version: type: git url: file:///vcstmp/vcs2l
By specifying the local paths, we do not have to change anything substantial in the testing scripts.
Hence, manually tagging, checking out, and adding specific commits is not required, as this is supported natively when specifying paths with
file:///. -
The helper script to set up the repository in a temporary directory can be split according to the VCS clients, for instance,
test_helper_git,test_helper_tar,test_helper_svn, etc.Once the helper scripts are called before the actual testing, we can include the files with direct directories to the temporary named paths:
list.repos# Repo URL is fixed to local path for testing purposes --- repositories: immutable/hash: type: git url: file:///vcstmp/vcs2l version: 377d5b3d03c212f015cc832fdb368f4534d0d583 immutable/hash_tar: type: tar url: file:///vcstmp//vcs2l/archive/377d5b3d03c212f015cc832fdb368f4534d0d583.tar.gz version: vcs2l-377d5b3d03c212f015cc832fdb368f4534d0d583 immutable/hash_zip: type: zip url: file:///vcstmp//vcs2l/archive/377d5b3d03c212f015cc832fdb368f4534d0d583.zip version: vcs2l-377d5b3d03c212f015cc832fdb368f4534d0d583 immutable/tag: type: git url: file:///vcstmp/vcs2l version: tags/0.1.27 vcs2l: type: git url: file:///vcstmp/vcs2l version: heads/main without_version: type: git url: file:///vcstmp/vcs2l
list2.repos# Repo url is fixed to local path for testing purposes --- repositories: hg/branch: type: hg url: file:///vcstmp/hgrepo version: stable hg/hash: type: hg url: file:///vcstmp/hgrepo version: 9bd654917508 hg/tag: type: hg url: file:///vcstmp/hgrepo version: 5.8 svn/rev: type: svn url: file:///vcstmp/svnrepo version: 1
-
These suggestions are mainly motivated by the incoming
extends:field in #39, supporting multi-level inheritance. If the test files are separated from the scripts, then it is easy for the user to add checks for subsequent features to come.
No worries, Scott. Grateful for your contribution as always :) |
|
Hi, thanks for having a look.
On the contrary, there is now a list of commands for setting up the repository that the user can change or append to for any features they need tested. #74 already demonstrates this - we don't need to push any annotated tags to the
The main reason I switched to curating the repositories-under-test is that relying on the
The
This is a reasonable request, and I think we should consider refactoring the tests to do so. It would also be nice if it was possible to run at least some of the tests without As I mentioned in my initial comment, I'm really trying to focus this change on getting things offline and resist the urge to refactor the tests. This PR touches a lot of code and has a high likelihood to conflict with other changes so I'd like to get it reviewed and merged quickly, and we can iterate on more focused refactoring of the tests in follow-up changes. Another refactor I'd like to do later is to leverage an additional temporary directory for the target of the import operation. We shouldn't just assume that the working directory is a good place to stash changes, and the tests can leave the temporary files on disk if you Ctrl-C in the right spot today, which makes subsequent test invocations fail persistently. Again, I'd like to keep refactors like this in separate PRs.
That's the idea, really. The "setup" portion all happens in |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #72 +/- ##
=======================================
Coverage 26.98% 26.98%
=======================================
Files 31 31
Lines 2238 2238
Branches 392 392
=======================================
Hits 604 604
Misses 1574 1574
Partials 60 60 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Thank you for the explanation, Scott. I understand the use of named temporary directories in this case, my reasoning was that we could have a 'named' directory for each VCS client, so that the user can easily edit a future
Okay, sure, I understand that is where the priority lies.
My immediate concern is that integration with #39 - multi-level inheritance will not be straightforward. |
+1 ticketing the test refactor and making an incremental improvement (that unblocks upstreaming into EPEL) is the approach that I would take here. Perfect being the enemy of good and all that. |
|
I responded to the PR feedback. I don't think any of us are super thrilled with this PR. I have an idea, but before I do the work, I want to discuss. Would it be better, at this stage, to break this into two PRs?
This puts the stage fixtures for each "client" type in a better place for refactoring later, and avoids the on-the-fly creation of the Thoughts? |
Yes, I agree that the points that you've discussed are a great way to make improvements on this PR.
The test fixtures could be structured in a way to preserve the style of For instance:
# Repo URL is fixed to local path for testing purposes
---
repositories:
hash:
type: git
url: file:///vcstmp/vcs2l
version: $random_hash$
tar:
type: tar
url: file:///vcstmp//vcs2l/archive/$random_hash$.tar.gz
version: vcs2l-$random_hash$
zip:
type: zip
url: file:///vcstmp//vcs2l/archive/$random_hash$.zip
version: vcs2l-$random_hash$
To achieve this, we can have separate scripts for each client - Therefore, the next two PRs can be as follows:
Please let me know if I interpreted the next steps correctly. In addition, I have approved this PR and will merge it as soon as the conflicts are resolved. |
claraberendsen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, we should extract the discussion to it's own issue
Relying only on local resources results in more reliable test results and enables development without reliable internet access. Signed-off-by: Scott K Logan <logans@cottsay.net>
b1aeee0 to
79c194d
Compare
Basic Info
Description of contribution in a few bullet points
Relying only on local resources results in more reliable test results and enables development without reliable internet access.
This change creates repository artifacts on-the-fly during test execution so that the same functionality can be validated without relying on live repositories on the internet.
Description of how this change was tested
pre-commit run --allpytest -s -v test