Skip to content

Commit cb40d57

Browse files
committed
Add ndbm C module to supported list.
1 parent d9135c8 commit cb40d57

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

patch/Python/Setup.embedded

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ _collections _collectionsmodule.c
1818
_contextvars _contextvarsmodule.c
1919
_crypt _cryptmodule.c
2020
_csv _csv.c
21+
_dbm _dbmmodule.c -DHAVE_NDBM_H
2122
_datetime _datetimemodule.c
2223
_elementtree _elementtree.c \
2324
-I$(srcdir)/Modules/expat
@@ -108,7 +109,6 @@ zlib zlibmodule.c -I$(prefix)/include -lz
108109
#####################################################################
109110
#_curses _cursesmodule.c -lcurses -ltermcap
110111
#_curses_panel _curses_panel.c -lpanel -lncurses
111-
#_dbm _dbmmodule.c
112112
#_gdbm _gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm
113113
#_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT -I... -L...
114114
#nis nismodule.c -lnsl

tests/testbed/src/testbed/common.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
###########################################################################
22
# Common tests
33
###########################################################################
4+
import os
5+
46
from .utils import assert_
57

68

@@ -26,6 +28,49 @@ def test_ctypes():
2628
absolute = full.absoluteURL
2729
assert_(absolute.description == "https://beeware.org/contributing")
2830

31+
def test_dbm():
32+
"The DBM module is accessible"
33+
import dbm
34+
35+
cache_name = f'{os.path.dirname(__file__)}/dbm'
36+
try:
37+
with dbm.open(cache_name, 'c') as db:
38+
db['hello'] = 'world'
39+
40+
assert_(db['hello'] == b'world')
41+
finally:
42+
os.remove(f'{cache_name}.db')
43+
44+
45+
def test_dbm_dumb():
46+
"The dumb DBM module has been compiled and works"
47+
from dbm import dumb as ddbm
48+
49+
cache_name = f'{os.path.dirname(__file__)}/ddbm'
50+
try:
51+
with ddbm.open(cache_name, 'c') as db:
52+
db['hello'] = 'world'
53+
54+
assert_(db['hello'] == b'world')
55+
finally:
56+
os.remove(f'{cache_name}.bak')
57+
os.remove(f'{cache_name}.dat')
58+
os.remove(f'{cache_name}.dir')
59+
60+
61+
def test_dbm_ndbm():
62+
"The ndbm DBM module has been compiled and works"
63+
from dbm import ndbm
64+
65+
cache_name = f'{os.path.dirname(__file__)}/ndbm'
66+
try:
67+
with ndbm.open(cache_name, 'c') as db:
68+
db['hello'] = 'world'
69+
70+
assert_(db['hello'] == b'world')
71+
finally:
72+
os.remove(f'{cache_name}.db')
73+
2974

3075
def test_decimal():
3176
"The decimal module works"

0 commit comments

Comments
 (0)