Skip to content
Permalink
Browse files

TST a test to show that dupefilter persistence is not working

  • Loading branch information
kmike authored and dangra committed Dec 30, 2015
1 parent d9b4850 commit 97f2fb302da06e80bbfb976157061ae51271496f
Showing with 23 additions and 0 deletions.
  1. +23 −0 tests/test_dupefilters.py
@@ -1,5 +1,7 @@
import hashlib
import tempfile
import unittest
import shutil

from scrapy.dupefilters import RFPDupeFilter
from scrapy.http import Request
@@ -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.

0 comments on commit 97f2fb3

Please sign in to comment.