1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 14:41:39 +00:00

Stop using hsutil.testcase.

This commit is contained in:
Virgil Dupras
2011-01-05 11:11:21 +01:00
parent 2d423b2358
commit e0cc8ecda2
7 changed files with 1030 additions and 1016 deletions

View File

@@ -9,12 +9,11 @@
from hsutil import io
from hsutil.path import Path
from hsutil.testcase import TestCase
from core.engine import getwords
from ..scanner import *
class NamedObject(object):
class NamedObject:
def __init__(self, name="foobar", size=1):
self.name = name
self.size = size
@@ -24,18 +23,18 @@ class NamedObject(object):
no = NamedObject
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
def pytest_funcarg__fake_fileexists(request):
# This is a hack to avoid invalidating all previous tests since the scanner started to test
# for file existence before doing the match grouping.
monkeypatch = request.getfuncargvalue('monkeypatch')
monkeypatch.setattr(io, 'exists', lambda _: True)
def test_priorize_me(fake_fileexists):
# 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