-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from endlisnis/master
Add a blocking commit after each modification if autocommit is enabled.
- Loading branch information
Showing
3 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import sqlitedict | ||
|
||
d = sqlitedict.SqliteDict('tests/db/autocommit.sqlite', autocommit=True) | ||
|
||
for i in range(1000): | ||
d[i] = i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import sys, os | ||
import sqlitedict | ||
|
||
def test(): | ||
"Verify autocommit just before program exits." | ||
assert os.system('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) |