Skip to content

Commit

Permalink
some small changes in tests for movementdetection
Browse files Browse the repository at this point in the history
  • Loading branch information
carienmol committed Mar 28, 2024
1 parent ed71b09 commit 556762f
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions birdwatcher/tests/test_movementdetection.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class TestDetectMovement(unittest.TestCase):

def setUp(self):
self.tempdirname1 = Path(tempfile.mkdtemp())
self.vfs = (bw.testvideosmall()
.iter_frames(nframes=200)
.tovideo(self.tempdirname1 / 'even1.mp4', framerate=25))
self.vfs = bw.testvideosmall()

def tearDown(self):
shutil.rmtree(self.tempdirname1)
Expand Down Expand Up @@ -68,29 +66,26 @@ class TestBatchDetectMovement(unittest.TestCase):

def setUp(self):
self.tempdirname1 = Path(tempfile.mkdtemp())
self.vfs = (bw.testvideosmall()
self.vfs1 = (bw.testvideosmall()
.iter_frames(nframes=200)
.tovideo(self.tempdirname1 / 'even1.mp4', framerate=25))
.tovideo(self.tempdirname1 / 'video1.mp4', framerate=25))
self.vfs2 = (bw.testvideosmall()
.iter_frames(nframes=200)
.tovideo(self.tempdirname1 / 'video2.mp4', framerate=25))

def tearDown(self):
shutil.rmtree(self.tempdirname1)

def test_batchdetection(self):
p1 = self.vfs
p2 = p1.iter_frames().tovideo(self.tempdirname1 / 'even2.mp4',
framerate=p1.avgframerate)
md.batch_detect_movement([p1,p2], nframes=200,
md.batch_detect_movement([self.vfs1,self.vfs2], nframes=200,
analysispath=self.tempdirname1,
overwrite=True, archived=False)
filepath = self.tempdirname1 / 'movement_even1/coords.darr'
self.assertTrue(Path.exists(filepath))
self.assertTrue(Path.exists(self.tempdirname1/'movement_video1/coords.darr'))
self.assertTrue(Path.exists(self.tempdirname1/'movement_video2/coords.darr'))

def test_batcharchive(self):
p1 = self.vfs
p2 = p1.iter_frames().tovideo(self.tempdirname1 / 'even2.mp4',
framerate=p1.avgframerate)
md.batch_detect_movement([p1,p2], nframes=200,
md.batch_detect_movement([self.vfs1,self.vfs2], nframes=200,
analysispath=self.tempdirname1,
overwrite=True, archived=True)
filepath = self.tempdirname1 / 'movement_even1/coords.darr.tar.xz'
self.assertTrue(Path.exists(filepath))
self.assertTrue(Path.exists(self.tempdirname1/'movement_video1/coords.darr.tar.xz'))
self.assertTrue(Path.exists(self.tempdirname1/'movement_video2/coords.darr.tar.xz'))

0 comments on commit 556762f

Please sign in to comment.