From d2e2f337f6d18723a5a0cf3e13ec411308f787b4 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Wed, 13 Jan 2010 09:35:37 +0100 Subject: [PATCH] Fixed core_me.tests.scanner_test which was broken. --- core_me/tests/scanner_test.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/core_me/tests/scanner_test.py b/core_me/tests/scanner_test.py index 074e3e8c..f92bd201 100644 --- a/core_me/tests/scanner_test.py +++ b/core_me/tests/scanner_test.py @@ -7,7 +7,9 @@ # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licenses/hs_license +from hsutil import io from hsutil.path import Path +from hsutil.testcase import TestCase from core.engine import getwords from ..scanner import * @@ -22,11 +24,18 @@ class NamedObject(object): no = NamedObject -def test_priorize_me(): - # in ScannerME, bitrate goes first (right after is_ref) in priorization - s = ScannerME() - o1, o2 = no('foo'), no('foo') - o1.bitrate = 1 - o2.bitrate = 2 - [group] = s.GetDupeGroups([o1, o2]) - assert group.ref is o2 \ No newline at end of file +class ScannerTestFakeFiles(TestCase): + def setUp(self): + # This is a hack to avoid invalidating all previous tests since the scanner started to test + # for file existence before doing the match grouping. + self.mock(io, 'exists', lambda _: True) + + def test_priorize_me(self): + # in ScannerME, bitrate goes first (right after is_ref) in priorization + s = ScannerME() + o1, o2 = no('foo'), no('foo') + o1.bitrate = 1 + o2.bitrate = 2 + [group] = s.GetDupeGroups([o1, o2]) + assert group.ref is o2 +