File: test_autocommit.py

package info (click to toggle)
sqlitedict 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 200 kB
  • sloc: python: 825; makefile: 31; sh: 7
file content (14 lines) | stat: -rw-r--r-- 462 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import os
import sys

import sqlitedict


def test():
    "Verify autocommit just before program exits."
    assert os.system('env PYTHONPATH=. %s tests/autocommit.py' % sys.executable) == 0
    # The above script relies on the autocommit feature working correctly.
    # Now, let's check if it actually worked.
    d = sqlitedict.SqliteDict('tests/db/autocommit.sqlite')
    for i in range(1000):
        assert d[i] == i, "actual: %s expected: %s" % (d[i], i)