Example #1
0
class TestBeep:
    def setup(self):
        recdir = "/fake"
        self.tmp = mkdtemp()
        config = SoundConfig(recdir=recdir, tmpdir=self.tmp)
        self.beep = Beep(config)

    def teardown(self):
        rmtree(self.tmp)

    def test_path(self):
        f = self.tmp + "/beep.wav"
        assert_equal(f, self.beep.path())

    def test_dir(self):
        # Always return tmpdir
        assert_equal(self.tmp, self.beep.dir())

    def test_compute(self):
        subprocess = Mock()
        self.beep.compute(subprocess)
        f = self.tmp + "/beep.wav"
        #cmd = 'sox -n -r 44100 -c 2 %s synth 0.1 tri 1000' % f
        cmd = ['sox', '-n', '-r', '44100', '-c', '2', f,
               'synth', '0.1', 'tri', '1000']
        subprocess.call.assert_called_with(cmd)
Example #2
0
 def setup(self):
     self.outdir = mkdtemp()
     self.recdir, self.tmp = mkdtemp(), mkdtemp()
     config = SoundConfig(recdir=self.recdir,
                          tmpdir=self.tmp,
                          outdir=self.outdir)
     self.sounds = [
         Recording(config, 'recording', 'Recording'),
         Silence(config, 2),
         Beep(config)
     ]
     self.sound = SoundConcat(config, 'drill', self.sounds)
Example #3
0
 def setup(self):
     recdir = "/fake"
     self.tmp = mkdtemp()
     config = SoundConfig(recdir=recdir, tmpdir=self.tmp)
     self.beep = Beep(config)