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

Unify audio modules tests #63119

Closed
serhiy-storchaka opened this issue Sep 4, 2013 · 19 comments
Closed

Unify audio modules tests #63119

serhiy-storchaka opened this issue Sep 4, 2013 · 19 comments
Assignees
Labels
tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 18919
Nosy @birkenfeld, @ned-deily, @bitdancer, @PCManticore, @serhiy-storchaka, @koobs
Dependencies
  • bpo-18878: Add support of the 'with' statement to sunau.open.
  • bpo-18950: Miscellaneous fixes for the sunau module
  • bpo-19131: Broken support of compressed AIFC files
  • Files
  • audiotests.patch
  • audiotests_2.patch
  • audiotests_3.patch
  • makeaudiotests.py: Helper script for generating testing data from testing files
  • test_aifc_capture_warnings.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2013-10-14.21:36:31.479>
    created_at = <Date 2013-09-04.11:11:50.579>
    labels = ['type-feature', 'tests']
    title = 'Unify audio modules tests'
    updated_at = <Date 2013-10-17.23:04:11.842>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2013-10-17.23:04:11.842>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2013-10-14.21:36:31.479>
    closer = 'serhiy.storchaka'
    components = ['Tests']
    creation = <Date 2013-09-04.11:11:50.579>
    creator = 'serhiy.storchaka'
    dependencies = ['18878', '18950', '19131']
    files = ['31584', '31632', '31911', '31912', '32109']
    hgrepos = []
    issue_num = 18919
    keywords = ['patch']
    message_count = 19.0
    messages = ['196900', '196901', '196903', '197106', '198632', '199611', '199712', '199720', '199851', '199854', '199912', '199921', '199926', '199927', '199928', '199932', '199938', '200103', '200174']
    nosy_count = 7.0
    nosy_names = ['georg.brandl', 'ned.deily', 'r.david.murray', 'Claudiu.Popa', 'python-dev', 'serhiy.storchaka', 'koobs']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue18919'
    versions = ['Python 2.7', 'Python 3.3', 'Python 3.4']

    @serhiy-storchaka
    Copy link
    Member Author

    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 (bpo-8934). 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.

    @serhiy-storchaka serhiy-storchaka self-assigned this Sep 4, 2013
    @serhiy-storchaka serhiy-storchaka added tests Tests in the Lib/test dir type-feature A feature request or enhancement labels Sep 4, 2013
    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Sep 4, 2013

    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.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 4, 2013

    New changeset 61ca4732399b by Serhiy Storchaka in branch 'default':
    Issues bpo-18901, bpo-18919: Fix a typo in the _sunau_params name.
    http://hg.python.org/cpython/rev/61ca4732399b

    @serhiy-storchaka
    Copy link
    Member Author

    Patch updated. It now contains tests for all supported encoding formats (PCM8-32, u-Law, A-Law).

    @serhiy-storchaka
    Copy link
    Member Author

    Patch updated. Now files created in external program (Audacity) are used for testing. This exposed yet one bug, in the aifc module (bpo-19131).

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 12, 2013

    New changeset 3303d735058f by Serhiy Storchaka in branch '2.7':
    Issue bpo-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 bpo-18919: If the close() method of a writer in the sunau or wave module
    http://hg.python.org/cpython/rev/b7eae747385c

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 13, 2013

    New changeset a9f967c8d002 by Serhiy Storchaka in branch '2.7':
    Issue bpo-18919: Added tests for the sunau module. Unified and extended tests
    http://hg.python.org/cpython/rev/a9f967c8d002

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 13, 2013

    New changeset ee7563b07c6f by Serhiy Storchaka in branch '3.3':
    Issue bpo-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 bpo-18919: Unified and extended tests for audio modules: aifc, sunau and
    http://hg.python.org/cpython/rev/fc418ecd8777

    @koobs
    Copy link

    koobs commented Oct 14, 2013

    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

    @serhiy-storchaka
    Copy link
    Member Author

    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().

    @bitdancer
    Copy link
    Member

    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.

    @birkenfeld
    Copy link
    Member

    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)

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 14, 2013

    New changeset 164a60cce934 by Serhiy Storchaka in branch '2.7':
    Issue bpo-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 bpo-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 bpo-18919: Check warnings messages in the aifc module tests.
    http://hg.python.org/cpython/rev/d168f094d16d

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 14, 2013

    New changeset fd7752db1e54 by Serhiy Storchaka in branch '2.7':
    Issue bpo-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 bpo-18919: Fixed resource leaks in audio tests.
    http://hg.python.org/cpython/rev/2850fc02f324

    New changeset 835c6ea487b1 by Serhiy Storchaka in branch 'default':
    Issue bpo-18919: Fixed resource leaks in audio tests.
    http://hg.python.org/cpython/rev/835c6ea487b1

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @ned-deily
    Copy link
    Member

    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.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 14, 2013

    New changeset de1f62a55648 by Serhiy Storchaka in branch '2.7':
    Issue bpo-18919: Add test/audiodata to LIBSUBDIRS.
    http://hg.python.org/cpython/rev/de1f62a55648

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

    New changeset 4d5143ff58ea by Serhiy Storchaka in branch 'default':
    Issue bpo-18919: Add test/audiodata to LIBSUBDIRS.
    http://hg.python.org/cpython/rev/4d5143ff58ea

    @bitdancer
    Copy link
    Member

    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

    @serhiy-storchaka
    Copy link
    Member Author

    Thank you David. Fixed in bpo-19276.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    tests Tests in the Lib/test dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants