This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Unify audio modules tests
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: 18878 18950 19131 Superseder:
Assigned To: serhiy.storchaka Nosy List: Claudiu.Popa, georg.brandl, koobs, ned.deily, python-dev, r.david.murray, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2013-09-04 11:11 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
audiotests.patch serhiy.storchaka, 2013-09-04 11:11 review
audiotests_2.patch serhiy.storchaka, 2013-09-06 21:29 review
audiotests_3.patch serhiy.storchaka, 2013-09-29 19:30 review
makeaudiotests.py serhiy.storchaka, 2013-09-29 19:36 Helper script for generating testing data from testing files
test_aifc_capture_warnings.patch serhiy.storchaka, 2013-10-14 08:58 review
Messages (19)
msg196900 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-04 11:11
Three audio modules, aifc, sunau and wave, have similar interfaces and poor tests. The proposed patch introduces new file Lib/test/audiotests.py with common audio tests.

New testing exposes some bugs and discrepancy between different audio modules. For example aifc uses bytes for compression type and name, while sunau and wave use strings (issue8934). aifc closes underlied file object on close(), while sunau and wave don't. wave rounds a framerate, while aifc and sunau truncate it. Different modules have different behaviors when process framedata with length which is not divisible by frame size.
msg196901 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2013-09-04 11:16
I love this idea! I was thinking while working on sunau/aifc/wave patches that we can do more than this, unify the entire audio modules,
getting rid of Aifc_write/read and Wave_write/read was in fact my first desire.
 One way that I thought about was to provide an abc and each module would implement that interface.
That way we could create new modules for audio operations for other formats as well. If this sounds like a good idea, I could try to provide a patch for this.
msg196903 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-09-04 11:30
New changeset 61ca4732399b by Serhiy Storchaka in branch 'default':
Issues #18901, #18919: Fix a typo in the _sunau_params name.
http://hg.python.org/cpython/rev/61ca4732399b
msg197106 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-06 21:02
Patch updated. It now contains tests for all supported encoding formats (PCM8-32, u-Law, A-Law).
msg198632 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-29 19:30
Patch updated. Now files created in external program (Audacity) are used for testing. This exposed yet one bug, in the aifc module (issue19131).
msg199611 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-12 18:39
New changeset 3303d735058f by Serhiy Storchaka in branch '2.7':
Issue #18919: If the close() method of a writer in the sunau or wave module
http://hg.python.org/cpython/rev/3303d735058f

New changeset b7eae747385c by Serhiy Storchaka in branch '3.3':
Issue #18919: If the close() method of a writer in the sunau or wave module
http://hg.python.org/cpython/rev/b7eae747385c
msg199712 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-13 14:52
New changeset a9f967c8d002 by Serhiy Storchaka in branch '2.7':
Issue #18919: Added tests for the sunau module.  Unified and extended tests
http://hg.python.org/cpython/rev/a9f967c8d002
msg199720 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-13 15:14
New changeset ee7563b07c6f by Serhiy Storchaka in branch '3.3':
Issue #18919: Unified and extended tests for audio modules: aifc, sunau and
http://hg.python.org/cpython/rev/ee7563b07c6f

New changeset fc418ecd8777 by Serhiy Storchaka in branch 'default':
Issue #18919: Unified and extended tests for audio modules: aifc, sunau and
http://hg.python.org/cpython/rev/fc418ecd8777
msg199851 - (view) Author: Kubilay Kocak (koobs) (Python triager) Date: 2013-10-14 08:18
Tests fail for 2.7 on the koobs-freebsd9 and koobs-freebsd10 buildbots since a9f967c8d002db364021a5fb1c9926a27029e849

Taking a snapshot of the output here for reference:

test_aifc
test test_aifc produced unexpected output:
**********************************************************************
Warning: bad COMM chunk size
Warning: bad COMM chunk size
Warning: MARK chunk contains only 0 markers instead of 1

**********************************************************************

<snip>

363 tests OK.
1 test failed:
    test_aifc

<snip>

Re-running failed tests in verbose mode
Re-running test 'test_aifc' in verbose mode

<snip>

test_read_comm_kludge_compname_even (test.test_aifc.AIFCLowLevelTest) ... Warning: bad COMM chunk size
ok
test_read_comm_kludge_compname_odd (test.test_aifc.AIFCLowLevelTest) ... Warning: bad COMM chunk size
ok
test_read_wrong_marks (test.test_aifc.AIFCLowLevelTest) ... Warning: MARK chunk contains only 0 markers instead of 1
ok

----------------------------------------------------------------------
Ran 80 tests in 0.102s

OK
msg199854 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-14 08:58
Is unexpected output considered as test failing? The aifc module uses bare print to output these "warnings" to stdout. Here is a patch which uses captured_stdout().
msg199912 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-10-14 15:48
In 2.7 unexpected output is a test failure, yes.

In 3.x we removed that check.  But I wonder if that was wise :)  (We did it for technical reasons when adding other features to regrtest).

Yes, using captured_stdout and checking for the expected warnings would be a better test, IMO.
msg199921 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-10-14 16:13
Some new (I assume) ResourceWarnings from test_wave:

/home/gbr/devel/python/Lib/unittest/case.py:571: ResourceWarning: unclosed file <_io.BufferedWriter name='@test_1974_tmp'>
  testMethod()
/home/gbr/devel/python/Lib/chunk.py:61: ResourceWarning: unclosed file <_io.FileIO name='/home/gbr/devel/python/Lib/test/audiodata/pluck-pcm16.wav' mode='rb'>
  self.chunkname = file.read(4)
/home/gbr/devel/python/Lib/chunk.py:61: ResourceWarning: unclosed file <_io.FileIO name='/home/gbr/devel/python/Lib/test/audiodata/pluck-pcm24.wav' mode='rb'>
  self.chunkname = file.read(4)
/home/gbr/devel/python/Lib/chunk.py:61: ResourceWarning: unclosed file <_io.FileIO name='/home/gbr/devel/python/Lib/test/audiodata/pluck-pcm32.wav' mode='rb'>
  self.chunkname = file.read(4)
/home/gbr/devel/python/Lib/chunk.py:61: ResourceWarning: unclosed file <_io.FileIO name='/home/gbr/devel/python/Lib/test/audiodata/pluck-pcm8.wav' mode='rb'>
  self.chunkname = file.read(4)
msg199926 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-14 17:06
New changeset 164a60cce934 by Serhiy Storchaka in branch '2.7':
Issue #18919: Catch and check warnings in the aifc module tests.
http://hg.python.org/cpython/rev/164a60cce934

New changeset 9eecd00ffc28 by Serhiy Storchaka in branch '3.3':
Issue #18919: Check warnings messages in the aifc module tests.
http://hg.python.org/cpython/rev/9eecd00ffc28

New changeset d168f094d16d by Serhiy Storchaka in branch 'default':
Issue #18919: Check warnings messages in the aifc module tests.
http://hg.python.org/cpython/rev/d168f094d16d
msg199927 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-14 17:11
New changeset fd7752db1e54 by Serhiy Storchaka in branch '2.7':
Issue #18919: Fixed resource leaks in audio tests.
http://hg.python.org/cpython/rev/fd7752db1e54

New changeset 2850fc02f324 by Serhiy Storchaka in branch '3.3':
Issue #18919: Fixed resource leaks in audio tests.
http://hg.python.org/cpython/rev/2850fc02f324

New changeset 835c6ea487b1 by Serhiy Storchaka in branch 'default':
Issue #18919: Fixed resource leaks in audio tests.
http://hg.python.org/cpython/rev/835c6ea487b1
msg199928 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-14 17:16
> In 3.x we removed that check.  But I wonder if that was wise :)  (We did it for technical reasons when adding other features to regrtest).

Actually the checks left, but there was no check for warning message. Now they are added.

> Some new (I assume) ResourceWarnings from test_wave:

Thank you Greg for this report. Yes, these warnings are new. The tests only existed for the aifc module (which always closes externally opened file), and when I extended it to other modules I forgot close externally opened files. Hope it now fixed.
msg199932 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-10-14 17:40
The new tests fail when run from an installed Python.  You also need to add all of the new test directories to LIBSUBDIRS for the libinstall target in Makefile.pre.in.
msg199938 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-14 18:20
New changeset de1f62a55648 by Serhiy Storchaka in branch '2.7':
Issue #18919: Add test/audiodata to LIBSUBDIRS.
http://hg.python.org/cpython/rev/de1f62a55648

New changeset 865bab7387f2 by Serhiy Storchaka in branch '3.3':
Issue #18919: Add test/audiodata to LIBSUBDIRS.
http://hg.python.org/cpython/rev/865bab7387f2

New changeset 4d5143ff58ea by Serhiy Storchaka in branch 'default':
Issue #18919: Add test/audiodata to LIBSUBDIRS.
http://hg.python.org/cpython/rev/4d5143ff58ea
msg200103 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-10-17 02:39
It looks like test_wave is still failing on PPC64 PowerLinux:

http://buildbot.python.org/all/builders/PPC64%20PowerLinux%203.x/builds/850/steps/test/logs/stdio
msg200174 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-17 23:04
Thank you David. Fixed in issue19276.
History
Date User Action Args
2022-04-11 14:57:50adminsetgithub: 63119
2013-10-17 23:04:11serhiy.storchakasetmessages: + msg200174
2013-10-17 02:39:47r.david.murraysetmessages: + msg200103
2013-10-14 21:36:31serhiy.storchakasetstatus: open -> closed
2013-10-14 18:20:16python-devsetmessages: + msg199938
2013-10-14 17:40:09ned.deilysetnosy: + ned.deily
messages: + msg199932
2013-10-14 17:16:52serhiy.storchakasetmessages: + msg199928
stage: patch review -> resolved
2013-10-14 17:11:02python-devsetmessages: + msg199927
2013-10-14 17:06:34python-devsetmessages: + msg199926
2013-10-14 16:13:03georg.brandlsetnosy: + georg.brandl
messages: + msg199921
2013-10-14 15:48:20r.david.murraysetmessages: + msg199912
2013-10-14 08:59:00serhiy.storchakasetstatus: closed -> open
stage: resolved -> patch review
2013-10-14 08:58:38serhiy.storchakasetfiles: + test_aifc_capture_warnings.patch

messages: + msg199854
2013-10-14 08:18:39koobssetnosy: + koobs
messages: + msg199851
2013-10-13 15:16:13serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2013-10-13 15:14:35python-devsetmessages: + msg199720
2013-10-13 14:52:57python-devsetmessages: + msg199712
2013-10-12 18:39:12python-devsetmessages: + msg199611
2013-09-29 19:36:17serhiy.storchakasetfiles: + makeaudiotests.py
2013-09-29 19:31:40serhiy.storchakasetfiles: + audiotests_3.patch

dependencies: + Broken support of compressed AIFC files
messages: + msg198632
2013-09-06 21:39:23serhiy.storchakalinkissue5202 dependencies
2013-09-06 21:29:15serhiy.storchakasetfiles: + audiotests_2.patch
2013-09-06 21:25:20serhiy.storchakasetdependencies: + Miscellaneous fixes for the sunau module
2013-09-06 21:02:47serhiy.storchakasetmessages: + msg197106
2013-09-04 11:32:06serhiy.storchakasetdependencies: + Add support of the 'with' statement to sunau.open.
2013-09-04 11:30:36python-devsetnosy: + python-dev
messages: + msg196903
2013-09-04 11:16:31Claudiu.Popasetmessages: + msg196901
2013-09-04 11:11:50serhiy.storchakacreate