summaryrefslogtreecommitdiff
path: root/tests/cache/test_dbm_backend.py
blob: 37ec588947b4bf3cc4598644807d48cd7f26f986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from ._fixtures import _GenericBackendTest, _GenericMutexTest
from . import eq_
from unittest import TestCase
from threading import Thread
import time
import os
from nose import SkipTest

try:
    import fcntl
except ImportError:
    raise SkipTest("fcntl not available")

class DBMBackendTest(_GenericBackendTest):
    backend = "dogpile.cache.dbm"

    config_args = {
        "arguments":{
            "filename":"test.dbm"
        }
    }

class DBMBackendNoLockTest(_GenericBackendTest):
    backend = "dogpile.cache.dbm"

    config_args = {
        "arguments":{
            "filename":"test.dbm",
            "rw_lockfile":False,
            "dogpile_lockfile":False,
        }
    }


class DBMMutexTest(_GenericMutexTest):
    backend = "dogpile.cache.dbm"

    config_args = {
        "arguments":{
            "filename":"test.dbm"
        }
    }


def teardown():
    for fname in os.listdir(os.curdir):
        if fname.startswith("test.dbm"):
            os.unlink(fname)