Port test_datasets_utils to pytest #4114
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #4063
@NicolasHug apologies for the delay. Please note the following main changes (might be helpful in reviewing the PR):
test_detect_file_type
is parametrized overfile, expected
test_detect_file_type_incompatible
now represents and clubs the following three different tests:test_detect_file_type_no_ext
test_detect_file_type_unknown_compression
test_detect_file_type_unknown_partial_ext
test_decompress
is parametrized overextension
and makes use of_COMPRESSED_FILE_OPENERS
dict
defined intorchvision.datasets.utils
. This also clubs following tests into one:test_decompress_bz2
test_decompress_gzip
test_decompress_lzma
test_extract_archive_defer_to_decompress
is parametrized overextension
andremove_finished
and makes use ofpytest-mock
. Note the original copy required to avoid mockedutils._decompress
function in the final assert.test_extract_tar
is parametrized overextension, mode
combiningtest_extract_tar
andtest_extract_tar_xz
into one.