Skip to content

Commit

Permalink
TST a test to show that dupefilter persistence is not working
Browse files Browse the repository at this point in the history
  • Loading branch information
kmike authored and dangra committed Dec 30, 2015
1 parent d9b4850 commit 97f2fb3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_dupefilters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import hashlib
import tempfile
import unittest
import shutil

from scrapy.dupefilters import RFPDupeFilter
from scrapy.http import Request
Expand All @@ -23,6 +25,27 @@ def test_filter(self):

dupefilter.close('finished')

def test_dupefilter_path(self):
r1 = Request('http://scrapytest.org/1')
r2 = Request('http://scrapytest.org/2')

path = tempfile.mkdtemp()
try:
df = RFPDupeFilter(path)
df.open()
assert not df.request_seen(r1)
assert df.request_seen(r1)
df.close('finished')

df2 = RFPDupeFilter(path)
df2.open()
assert df2.request_seen(r1)
assert not df2.request_seen(r2)
assert df2.request_seen(r2)
df2.close('finished')
finally:
shutil.rmtree(path)

def test_request_fingerprint(self):
"""Test if customization of request_fingerprint method will change
output of request_seen.
Expand Down

0 comments on commit 97f2fb3

Please sign in to comment.