From 1e0f31a7940183c90d67e3f828380ca9c6d2e629 Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Sat, 5 Jan 2019 12:25:34 -0800 Subject: [PATCH 1/4] Update test_wave_parsing.py Style --- tests/test_wave_parsing.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/test_wave_parsing.py b/tests/test_wave_parsing.py index 0aa9c59..4c5f8f6 100644 --- a/tests/test_wave_parsing.py +++ b/tests/test_wave_parsing.py @@ -10,11 +10,8 @@ import wavinfo FFPROBE='ffprobe' - def ffprobe(path): - arguments = [ FFPROBE , "-of", "json" , "-show_format", "-show_streams", path ] - if int(sys.version[0]) < 3: process = subprocess.Popen(arguments, stdout=PIPE) process.wait() @@ -27,7 +24,6 @@ def ffprobe(path): return None else: process = subprocess.run(arguments, stdin=None, stdout=PIPE, stderr=PIPE) - if process.returncode == 0: output_str = process.stdout.decode('utf-8') return json.loads(output_str) @@ -35,16 +31,13 @@ def ffprobe(path): return None class TestWaveInfo(TestCase): - - def all_files(self): - for dirpath, dirnames, filenames in os.walk('tests/test_files'): + for dirpath, _, filenames in os.walk('tests/test_files'): for filename in filenames: - name, ext = os.path.splitext(filename) + _, ext = os.path.splitext(filename) if ext in ['.wav','.WAV']: yield os.path.join(dirpath, filename) - def test_sanity(self): for wav_file in self.all_files(): info = wavinfo.WavInfoReader(wav_file) @@ -70,7 +63,6 @@ class TestWaveInfo(TestCase): for wav_file in self.all_files(): info = wavinfo.WavInfoReader(wav_file) ffprobe_info = ffprobe(wav_file) - self.assertEqual( info.data.frame_count, int(ffprobe_info['streams'][0]['duration_ts'] )) def test_bext_against_ffprobe(self): From 88da763ca1315b83fa535ed243378a86bbcb9f99 Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Sat, 5 Jan 2019 12:29:12 -0800 Subject: [PATCH 2/4] Update .travis.yml CODECOV_TOKEN --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4fbb2d2..1e410d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,12 @@ before_install: - "sudo add-apt-repository universe" - "sudo apt-get install -y ffmpeg" - "pip install coverage" + - "pip install codecov" # - "pip install coverage==4.4" - "pip install pytest-cov==2.5.0" - "pip install python-coveralls" install: - "pip install setuptools" after_success: + - "codecov --repo=$CODECOV_TOKEN" - coveralls From 7992640fb8af7623cff80ed6a6bd7af476fa38c4 Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Sat, 5 Jan 2019 12:32:47 -0800 Subject: [PATCH 3/4] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1e410d1..6714f83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,5 +19,5 @@ before_install: install: - "pip install setuptools" after_success: - - "codecov --repo=$CODECOV_TOKEN" + - "codecov -t" - coveralls From 12de7b078f54167763a04d7069fe8199099fc4ed Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Sat, 5 Jan 2019 12:34:54 -0800 Subject: [PATCH 4/4] Update test_wave_parsing.py --- tests/test_wave_parsing.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/test_wave_parsing.py b/tests/test_wave_parsing.py index 4c5f8f6..ddbae38 100644 --- a/tests/test_wave_parsing.py +++ b/tests/test_wave_parsing.py @@ -16,7 +16,7 @@ def ffprobe(path): process = subprocess.Popen(arguments, stdout=PIPE) process.wait() if process.returncode == 0: - output = process.communicate()[0] + output = process.communicate()[0] if output: output_str = output.decode('utf-8') return json.loads(output_str) @@ -30,21 +30,22 @@ def ffprobe(path): else: return None + +def all_files(): + for dirpath, _, filenames in os.walk('tests/test_files'): + for filename in filenames: + _, ext = os.path.splitext(filename) + if ext in ['.wav','.WAV']: + yield os.path.join(dirpath, filename) + class TestWaveInfo(TestCase): - def all_files(self): - for dirpath, _, filenames in os.walk('tests/test_files'): - for filename in filenames: - _, ext = os.path.splitext(filename) - if ext in ['.wav','.WAV']: - yield os.path.join(dirpath, filename) - def test_sanity(self): - for wav_file in self.all_files(): + for wav_file in all_files(): info = wavinfo.WavInfoReader(wav_file) self.assertTrue(info is not None) def test_fmt_against_ffprobe(self): - for wav_file in self.all_files(): + for wav_file in all_files(): info = wavinfo.WavInfoReader(wav_file) ffprobe_info = ffprobe(wav_file) @@ -60,13 +61,13 @@ class TestWaveInfo(TestCase): self.assertEqual( info.fmt.byte_rate , byte_rate ) def test_data_against_ffprobe(self): - for wav_file in self.all_files(): + for wav_file in all_files(): info = wavinfo.WavInfoReader(wav_file) ffprobe_info = ffprobe(wav_file) self.assertEqual( info.data.frame_count, int(ffprobe_info['streams'][0]['duration_ts'] )) def test_bext_against_ffprobe(self): - for wav_file in self.all_files(): + for wav_file in all_files(): info = wavinfo.WavInfoReader(wav_file) ffprobe_info = ffprobe(wav_file) if info.bext: @@ -98,7 +99,7 @@ class TestWaveInfo(TestCase): 'tape': '18Y12M31', 'family_uid': 'USSDVGR1112089007124001008206300'}, } - for wav_file in self.all_files(): + for wav_file in all_files(): basename = os.path.basename(wav_file) if basename in expected: info = wavinfo.WavInfoReader(wav_file)