Avoid deprecation warnings and other minor cleanups in FileUtilsTest#562
Conversation
|
-1 as is, deprecated code must still be tested. I guess we could have separate methods or classes that only test deprecated code but that seems like busy work. It is OK to change 'main' code to not use deprecated elements, as long as test coverage does not go down, in which case a new test should be written to cover that change, for example if a deprecated method ends up not called at all from anywhere. |
|
None of the deprecation changes affect the tests. They are changes to the setup code for the tests. More specifically it specifies a charset when writing initial data into a file that is overwritten, and the test is that the new data overwrites the old data. This does identify a few places where we've failed to deprecate/provide alternative for some methods in the model code in the writeLines methods that don't take character sets. |
|
There's one failure on Java 21 only. This test wasn't touched in this PR. It's probably just flaky, but it's also possible it's broken at HEAD: Error: Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.178 s <<< FAILURE! -- in org.apache.commons.io.FileUtilsWaitForTest |
|
As far as code coverage I see [2024-01-23T00:44:13.800Z] ['error'] There was an error running the uploader: Error uploading to https://codecov.io: Error: There was an error fetching the storage URL during POST: 404 - {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')} |
|
Hi @elharo
But they do since some of the changes are to I really don't want to fiddle with this type of change. If we want to create special tests that only test deprecated code (maybe using the |
|
Yes, they are in @test methods but no, they are not tested by these methods. All the ones I have changed here do is write some data into a file that is then overwritten before anything is asserted. The purpose is to make sure that data is overwritten by the subsequent calls when append=False, not to test that the deprecated method is behaving according to spec. |
|
@elharo I do not see any negative impact on the JaCoCo code coverage report for the |
@garydgregory