# HG changeset patch # User Amine Sehili # Date 1550409527 -3600 # Node ID d42c0c2858c55c39606b26388ed3f26da2db4cd2 # Parent 995a568e6eff490852ffdaf2def82cf7f7a4f6d7 Use TemporaryDirectory to export test audio files diff -r 995a568e6eff -r d42c0c2858c5 tests/test_io.py --- a/tests/test_io.py Sun Feb 17 14:02:45 2019 +0100 +++ b/tests/test_io.py Sun Feb 17 14:18:47 2019 +0100 @@ -581,8 +581,11 @@ def test_save_with_pydub(self): with patch("auditok.io.AudioSegment.export") as export: - _save_with_pydub(b"\0\0", "audio.org", "ogg", 16000, 2, 1) + tmpdir = TemporaryDirectory() + filename = os.path.join(tmpdir.name, "audio.ogg") + _save_with_pydub(b"\0\0", filename, "ogg", 16000, 2, 1) self.assertTrue(export.called) + tmpdir.cleanup() @genty_dataset( raw_with_audio_format=("audio", "raw"), @@ -649,5 +652,8 @@ ) def test_to_file_compressed(self, filename, audio_format, *mocks): with patch("auditok.io.AudioSegment.export") as export: + tmpdir = TemporaryDirectory() + filename = os.path.join(tmpdir.name, filename) to_file(b"\0\0", filename, audio_format, **AUDIO_PARAMS_SHORT) self.assertTrue(export.called) + tmpdir.cleanup()