Skip to content
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

Port test_datasets_utils to pytest #4114

Merged
merged 5 commits into from
Jun 25, 2021

Conversation

AnirudhDagar
Copy link
Contributor

@AnirudhDagar AnirudhDagar commented Jun 25, 2021

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 over file, 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 over extension and makes use of _COMPRESSED_FILE_OPENERS dict defined in torchvision.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 over extension and remove_finished and makes use of pytest-mock. Note the original copy required to avoid mocked utils._decompress function in the final assert.
  • test_extract_tar is parametrized over extension, mode combining test_extract_tar and test_extract_tar_xz into one.

@AnirudhDagar
Copy link
Contributor Author

#4113 makes the decompression maps public. I'll update (_COMPRESSED_FILE_OPENERS -> COMPRESSED_FILE_OPENERS ) this PR when that is merged.

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @AnirudhDagar , this looks great!

I just have one comment below which hopefully @pmeier can confirm

test/test_datasets_utils.py Outdated Show resolved Hide resolved
@AnirudhDagar
Copy link
Contributor Author

Some tests in the CI are failing but they seem unrelated to this PR.
Ps. Mentioning #4098 here since it adds some tests for rar extraction support.

@NicolasHug
Copy link
Member

Thanks a lot @AnirudhDagar !!

@AnirudhDagar AnirudhDagar deleted the test-dataset-utils branch June 25, 2021 11:18
facebook-github-bot pushed a commit that referenced this pull request Jun 28, 2021
Reviewed By: fmassa

Differential Revision: D29395325

fbshipit-source-id: f0313af872dc410cd9d5923c2f360133e6dc82b4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port test/test_datasets_utils.py to pytest
4 participants