From 61fcc9b7eb6dd2fabd818ac3e6801299a4811926 Mon Sep 17 00:00:00 2001 From: Pierre Mdawar Date: Thu, 3 Jan 2019 16:16:17 +0200 Subject: [PATCH] [tests] added test for not deleting the file if the same file is processed --- test/test_YoutubeDL.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py index 59a6f3dfb..c5c81067f 100644 --- a/test/test_YoutubeDL.py +++ b/test/test_YoutubeDL.py @@ -627,6 +627,16 @@ class TestYoutubeDL(unittest.TestCase): self.assertTrue(os.path.exists(audiofile), '%s doesn\'t exist' % audiofile) os.unlink(audiofile) + class SameFilePP(PostProcessor): + def run(self, info): + with open(info['filepath'], 'wt') as f: + f.write('EXAMPLE') + return [info['filepath']], info + + run_pp({'keepvideo': False}, SameFilePP) + self.assertTrue(os.path.exists(filename), '%s doesn\'t exist' % filename) + os.unlink(filename) + class ModifierPP(PostProcessor): def run(self, info): with open(info['filepath'], 'wt') as f: