Sorry, something went wrong.
| pytest | ||
| pytest-cov | ||
| pytest-instafail | ||
| pytest-subtests |
There was a problem hiding this comment.
I've used the subTest method of unittest.TestCase in test_env_vars_for_windows_tests. This pytest plugin gives pytest full support for that mechanism. It lets pytest continue with the other subtests even after one fails, as the unittest test runner would, and show separate passes and failures for the individual subtests. Separate results are shown only when at least one fails, so when everything passes the report remains uncluttered. (It also provides a subtests pytest fixture, though since this is not an autouse fixture it is not usable from within a method of a class that inherits from unittest.TestCase.)
I think this is useful to have going forward, since we have many test cases that are large with many separate assertions of separate facts about the system under test, and as they are updated, some of them could be improved by having their separate claims divided into subtests so they can be individually described and so failures don't unnecessarily block later subtests.
However, if you'd rather this plugin be used, it can be removed. test_env_vars_for_windows_tests could retain subtests--they will still each run if none fails, just like multiple assertions in a test case without subtests. Or I could replace the subtests with more @ddt parameterization, or manually, etc.
Sorry, something went wrong.
There was a problem hiding this comment.
I all sounds reasonable and in particular, since you are the one doing the work it seems fair that you can use the tooling you see as best fit. I also have no experience here and no preferences, and believe that anything that improves the tests in any way is very welcome. Thank you!
Sorry, something went wrong.
There was a problem hiding this comment.
Sounds good. For the conceptually unrelated reason that it would facilitate more fine-grained xfail marking--so we don't habitually carry XPASSing cases that aren't actually expected to have failed--I think the test class involved here, test.test_util.TestUtils, should be split, so that the cygpath-related tests can be pure pytest tests. The reason to split it is:
So long as it's acceptable to have multiple test classes in the same test module, this could be done at any time, and it may facilitate some other simplifications. I mention it here because I think it might lead to the elimination of subtests in this particular module, either by using @pytest.mark.parametrize for this too or for other reasons.
If that happens, I might remove the pytest-subtests test dependency, even though it might be re-added later, because the alternative of pytest-check may be preferable in some of the large test methods if they can also be converted to be pure pytest tests (because pytest-check supports a more compact syntax).
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks again for your amazing work! GitPython is being pulled out of a deep tech-debt hole thanks to it!
#1571 may or may not be resolved by this, which I think is to a large extent subjective.
Let's pro-actively assume it works and let them reply if they don't think so to possibly reopen the issue.
I am super-excited to see the progress towards native-windows CI :).
Please note that the coming weeks I try to handle merge 1 PR per day due to limited bandwidth. Me being slow isn't a sign of my (maybe perceived lack of) appreciation or care for your work. Thanks for your understanding.
Sorry, something went wrong.
| pytest | ||
| pytest-cov | ||
| pytest-instafail | ||
| pytest-subtests |
There was a problem hiding this comment.
I all sounds reasonable and in particular, since you are the one doing the work it seems fair that you can use the tooling you see as best fit. I also have no experience here and no preferences, and believe that anything that improves the tests in any way is very welcome. Thank you!
Sorry, something went wrong.
|
Please note that the coming weeks I try to handle merge 1 PR per day due to limited bandwidth. Me being slow isn't a sign of my (maybe perceived lack of) appreciation or care for your work. Thanks for your understanding. No problem!! I'm unsure if you mean you expect to review one PR in GitPython daily (which would be a higher rate than I am currently managing to open them and I would likely notice no difference), or across all repositories (in which case I might notice some difference, since this would mean longer turnaround times for GitPython). But either way that is absolutely no problem! Extremely short turnaround times for reviewing PRs is something I've actually never seen, in any project, until contributing to GitPython, and I definitely do not expect that to always happen! (Furthermore, in most cases, having one PR open would not prevent me from opening another PR to make a mostly unrelated change, nor when I have multiple PRs open is there any need for them to be reviewed or merged on the same day, week, etc., as each other, nor necessarily in the order in which they were opened.) |
Sorry, something went wrong.
|
I'm unsure if you mean you expect to review one PR in GitPython daily (which would be a higher rate than I am currently managing to open them and I would likely notice no difference), or across all repositories (in which case I might notice some difference, since this would mean longer turnaround times for GitPython Hehe, I only meant 1 PR per day in GitPython - it's also currently the most active repository thanks to you so most of my time goes here. If you are ever interested how much that it, I do publish timesheets of my public work on a monthly cadence. |
Sorry, something went wrong.
|
Thanks! I was aware of the timesheets' existence, yet I had somehow assumed, without checking, that most of your public work, time-wise, went into gitoxide. |
Sorry, something went wrong.
|
[..] thanks to you so most of my time goes here. Right - most of my maintenance time goes here, apologies for the lack of specificity. But even gitoxide takes a back-seat sometimes. |
Sorry, something went wrong.
|
Right - most of my maintenance time goes here, apologies for the lack of specificity. That's okay, I had also assumed (erroneously, and I'm not sure why) that most of your maintenance time went into gitoxide. :) |
Sorry, something went wrong.
Fixes #1698
Fixes #1699
May close #1571
This takes the approaches I suggested in #1698 and #1699 for those two issues. It also adds tests for both the already-working behavior and the new behavior. For the tests of new behavior, I have manually verified they failed in the expected way, and now pass, on native Windows. (Other results can be seen on CI.)
For interpreting the HIDE_WINDOWS_KNOWN_ERRORS and HIDE_WINDOWS_FREEZE_ERRORS environment variables:
When limiting the exceptions the rmtree callback catches and reraises as unittest.SkipTest to PermissionError, I made a couple other changes as well:
#1571 may or may not be resolved by this, which I think is to a large extent subjective. That issue does two things. It documents a problem from 3.12.0.alpha7, which I believe was fixed, as I commented there. It also notes the deprecated status of shutil.rmtree's onerror argument and advocates that onexc be used instead. This was originally with the idea that using onerror caused or contributed to the observed test failures, but even though that was probably not the case, the issue might have been taken to stand for that as well.
I also fixed the type hints on the callback, renamed the callback itself as handler so it is no longer named after one of those two keyword arguments but not the other (which I think could cause confusing), and renamed its parameters to more closely match the documentation. As it is a local function that is not returned, this does not raise any compatibility issues. In a similar vein, I've included a number of low-stakes refactorings, mostly just to imports, in modules I was already modifying heavily, mainly in test_util.
This also adds a missing xfail and updates commented references to the callback-based skipping logic that already existed. Most tests that get skipped in this way, of which there are about eight, do not have comments like this, and I have not added them. The tests that did are those that had previously been marked with @skipIf decorators. Finally, I've updated the git.util.rmtree docstring, which will affect generated documentation.
This relates to, but only somewhat mitigates and definitely does not solve, #790.