Beispiel #1
0
    def test_malformed_output(self, call_patch):
        # Return malformed XML (the ampersand should be &)
        call_patch.return_value = CommandOutput(stdout=b"""
            <album>
                <track total="1" number="1" file="&">
                    <integrated lufs="0" lu="0" />
                    <sample-peak spfs="0" factor="0" />
                </track>
            </album>
        """,
                                                stderr="")

        with capture_log('beets.replaygain') as logs:
            self.run_command('replaygain')

        # Count how many lines match the expected error.
        matching = [line for line in logs if 'malformed XML' in line]

        self.assertEqual(len(matching), 2)
Beispiel #2
0
    def setUp(self, call_patch):
        self.setup_beets()
        self.config['replaygain']['backend'] = 'bs1770gain'

        # Patch call to return nothing, bypassing the bs1770gain installation
        # check.
        call_patch.return_value = CommandOutput(stdout=b"", stderr=b"")
        try:
            self.load_plugins('replaygain')
        except Exception:
            import sys
            exc_info = sys.exc_info()
            try:
                self.tearDown()
            except Exception:
                pass
            six.reraise(exc_info[1], None, exc_info[2])

        for item in self.add_album_fixture(2).items():
            reset_replaygain(item)