-
Notifications
You must be signed in to change notification settings - Fork 71
Remove tests from collection #1068
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
Merged
+97
−55
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
451189e
remove tests from collection
bff16e6
Merge branch 'meta-pytorch:main' into skip-tests
mollyxu c136cab
fix testcase
e41719b
Merge branch 'main' into skip-tests
mollyxu b5b42d9
fix merge error
5893519
Merge branch 'meta-pytorch:main' into skip-tests
mollyxu 0eef68a
fix merge error
5626b49
address feedback
39d3d30
Merge branch 'meta-pytorch:main' into skip-tests
mollyxu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,9 +17,9 @@ | |
| assert_tensor_close_on_at_least, | ||
| get_ffmpeg_major_version, | ||
| get_ffmpeg_minor_version, | ||
| in_fbcode, | ||
| IS_WINDOWS, | ||
| NASA_AUDIO_MP3, | ||
| needs_ffmpeg_cli, | ||
| psnr, | ||
| SINE_MONO_S32, | ||
| TEST_SRC_2_720P, | ||
|
|
@@ -217,13 +217,22 @@ def test_bad_input_parametrized(self, method, tmp_path): | |
| getattr(decoder, method)(**valid_params, num_channels=num_channels) | ||
|
|
||
| @pytest.mark.parametrize("method", ("to_file", "to_tensor", "to_file_like")) | ||
| @pytest.mark.parametrize("format", ("wav", "flac")) | ||
| @pytest.mark.parametrize( | ||
| "format", | ||
| [ | ||
| pytest.param( | ||
| "wav", | ||
| marks=pytest.mark.skipif( | ||
| get_ffmpeg_major_version() == 4, | ||
| reason="Swresample with FFmpeg 4 doesn't work on wav files", | ||
| ), | ||
| ), | ||
| "flac", | ||
| ], | ||
| ) | ||
| def test_round_trip(self, method, format, tmp_path): | ||
| # Check that decode(encode(samples)) == samples on lossless formats | ||
|
|
||
| if get_ffmpeg_major_version() == 4 and format == "wav": | ||
| pytest.skip("Swresample with FFmpeg 4 doesn't work on wav files") | ||
|
|
||
| asset = NASA_AUDIO_MP3 | ||
| source_samples = self.decode(asset).data | ||
|
|
||
|
|
@@ -249,7 +258,7 @@ def test_round_trip(self, method, format, tmp_path): | |
| self.decode(encoded_source).data, source_samples, rtol=rtol, atol=atol | ||
| ) | ||
|
|
||
| @pytest.mark.skipif(in_fbcode(), reason="TODO: enable ffmpeg CLI") | ||
| @needs_ffmpeg_cli | ||
| @pytest.mark.parametrize("asset", (NASA_AUDIO_MP3, SINE_MONO_S32)) | ||
| @pytest.mark.parametrize("bit_rate", (None, 0, 44_100, 999_999_999)) | ||
| @pytest.mark.parametrize("num_channels", (None, 1, 2)) | ||
|
|
@@ -356,17 +365,31 @@ def test_against_cli( | |
| @pytest.mark.parametrize("asset", (NASA_AUDIO_MP3, SINE_MONO_S32)) | ||
| @pytest.mark.parametrize("bit_rate", (None, 0, 44_100, 999_999_999)) | ||
| @pytest.mark.parametrize("num_channels", (None, 1, 2)) | ||
| @pytest.mark.parametrize("format", ("mp3", "wav", "flac")) | ||
| @pytest.mark.parametrize( | ||
| "format", | ||
| [ | ||
| # TODO: https://github.com/pytorch/torchcodec/issues/837 | ||
| pytest.param( | ||
| "mp3", | ||
| marks=pytest.mark.skipif( | ||
| IS_WINDOWS and get_ffmpeg_major_version() <= 5, | ||
| reason="Encoding mp3 on Windows is weirdly buggy", | ||
| ), | ||
| ), | ||
| pytest.param( | ||
| "wav", | ||
| marks=pytest.mark.skipif( | ||
| get_ffmpeg_major_version() == 4, | ||
| reason="Swresample with FFmpeg 4 doesn't work on wav files", | ||
| ), | ||
| ), | ||
| "flac", | ||
| ], | ||
| ) | ||
| @pytest.mark.parametrize("method", ("to_tensor", "to_file_like")) | ||
| def test_against_to_file( | ||
| self, asset, bit_rate, num_channels, format, tmp_path, method | ||
| ): | ||
| if get_ffmpeg_major_version() == 4 and format == "wav": | ||
| pytest.skip("Swresample with FFmpeg 4 doesn't work on wav files") | ||
| if IS_WINDOWS and get_ffmpeg_major_version() <= 5 and format == "mp3": | ||
| # TODO: https://github.com/pytorch/torchcodec/issues/837 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to preserve the comment pointing to an issue?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think line 371 is a good place to move this TODO? |
||
| pytest.skip("Encoding mp3 on Windows is weirdly buggy") | ||
|
|
||
| encoder = AudioEncoder(self.decode(asset).data, sample_rate=asset.sample_rate) | ||
|
|
||
| params = dict(bit_rate=bit_rate, num_channels=num_channels) | ||
|
|
@@ -847,16 +870,27 @@ def encode_to_tensor(frames): | |
| ) | ||
|
|
||
| @pytest.mark.parametrize( | ||
| "format", ("mov", "mp4", "mkv", pytest.param("webm", marks=pytest.mark.slow)) | ||
| "format", | ||
| [ | ||
| "mov", | ||
| "mp4", | ||
| "mkv", | ||
| pytest.param( | ||
| "webm", | ||
| marks=[ | ||
| pytest.mark.slow, | ||
| pytest.mark.skipif( | ||
| get_ffmpeg_major_version() == 4 | ||
| or (IS_WINDOWS and get_ffmpeg_major_version() in (6, 7)), | ||
| reason="Codec for webm is not available in this FFmpeg installation.", | ||
| ), | ||
| ], | ||
| ), | ||
| ], | ||
| ) | ||
| @pytest.mark.parametrize("method", ("to_file", "to_tensor", "to_file_like")) | ||
| def test_round_trip(self, tmp_path, format, method): | ||
| # Test that decode(encode(decode(frames))) == decode(frames) | ||
| ffmpeg_version = get_ffmpeg_major_version() | ||
| if format == "webm" and ( | ||
| ffmpeg_version == 4 or (IS_WINDOWS and ffmpeg_version in (6, 7)) | ||
| ): | ||
| pytest.skip("Codec for webm is not available in this FFmpeg installation.") | ||
| source_frames, frame_rate = self.decode_and_get_frame_rate(TEST_SRC_2_720P.path) | ||
|
|
||
| encoder = VideoEncoder(frames=source_frames, frame_rate=frame_rate) | ||
|
|
@@ -889,25 +923,29 @@ def test_round_trip(self, tmp_path, format, method): | |
|
|
||
| @pytest.mark.parametrize( | ||
| "format", | ||
| ( | ||
| [ | ||
| "mov", | ||
| "mp4", | ||
| "avi", | ||
| "mkv", | ||
| "flv", | ||
| "gif", | ||
| pytest.param("webm", marks=pytest.mark.slow), | ||
| ), | ||
| pytest.param( | ||
| "webm", | ||
| marks=[ | ||
| pytest.mark.slow, | ||
| pytest.mark.skipif( | ||
| get_ffmpeg_major_version() == 4 | ||
| or (IS_WINDOWS and get_ffmpeg_major_version() in (6, 7)), | ||
| reason="Codec for webm is not available in this FFmpeg installation.", | ||
| ), | ||
| ], | ||
| ), | ||
| ], | ||
| ) | ||
| @pytest.mark.parametrize("method", ("to_tensor", "to_file_like")) | ||
| def test_against_to_file(self, tmp_path, format, method): | ||
| # Test that to_file, to_tensor, and to_file_like produce the same results | ||
| ffmpeg_version = get_ffmpeg_major_version() | ||
| if format == "webm" and ( | ||
| ffmpeg_version == 4 or (IS_WINDOWS and ffmpeg_version in (6, 7)) | ||
| ): | ||
| pytest.skip("Codec for webm is not available in this FFmpeg installation.") | ||
|
|
||
| source_frames, frame_rate = self.decode_and_get_frame_rate(TEST_SRC_2_720P.path) | ||
| encoder = VideoEncoder(frames=source_frames, frame_rate=frame_rate) | ||
|
|
||
|
|
@@ -928,7 +966,7 @@ def test_against_to_file(self, tmp_path, format, method): | |
| rtol=0, | ||
| ) | ||
|
|
||
| @pytest.mark.skipif(in_fbcode(), reason="ffmpeg CLI not available") | ||
| @needs_ffmpeg_cli | ||
| @pytest.mark.parametrize( | ||
| "format", | ||
| ( | ||
|
|
@@ -1150,10 +1188,7 @@ def write(self, data): | |
| ): | ||
| encoder.to_file_like(NoSeekMethod(), format="mp4") | ||
|
|
||
| @pytest.mark.skipif( | ||
| in_fbcode(), | ||
| reason="ffprobe not available internally", | ||
| ) | ||
| @needs_ffmpeg_cli | ||
| @pytest.mark.parametrize( | ||
| "format,codec_spec", | ||
| [ | ||
|
|
@@ -1181,10 +1216,7 @@ def test_codec_parameter_utilized(self, tmp_path, format, codec_spec): | |
| ] | ||
| assert actual_codec_spec == codec_spec | ||
|
|
||
| @pytest.mark.skipif( | ||
| in_fbcode(), | ||
| reason="ffprobe not available internally", | ||
| ) | ||
| @needs_ffmpeg_cli | ||
| @pytest.mark.parametrize( | ||
| "codec_spec,codec_impl", | ||
| [ | ||
|
|
@@ -1227,7 +1259,7 @@ def test_codec_spec_vs_impl_equivalence(self, tmp_path, codec_spec, codec_impl): | |
| frames_impl = self.decode(impl_output) | ||
| torch.testing.assert_close(frames_spec, frames_impl, rtol=0, atol=0) | ||
|
|
||
| @pytest.mark.skipif(in_fbcode(), reason="ffprobe not available") | ||
| @needs_ffmpeg_cli | ||
| @pytest.mark.parametrize( | ||
| "profile,colorspace,color_range", | ||
| [ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
QQ @mollyxu , if we use
@pytest.mark.skipif(cond, ...)and
condisFalse, does the test still have the mark? I just want to make sure we're not skipping tests that shouldn't be skipped. It might be worth adding a small comment :) !