Ensure removal of temporary directories.
@@ -28,6 +28,8 @@ from bayeslite.backends.loom_backend import LoomBackend
from bayeslite.exception import BQLError
from bayeslite.exception import BQLParseError
from stochastic import stochastic
+from test_loom_backend import tempdir
+
'''This test provides coverage for ESTIMATE and SIMULATE of conditional mutual
information queries for univariate and multivariate targets and conditioning
@@ -61,11 +63,12 @@ def smoke_bdb():
@contextlib.contextmanager
def smoke_loom():
+ with tempdir('bayeslite-loom') as loom_store_path:
with bayesdb_open(':memory:') as bdb:
- path = os.path.dirname(os.path.abspath(__file__))
bayesdb_register_backend(
bdb,
- LoomBackend(loom_store_path= path + '/tmp/loom.store'))
+ LoomBackend(loom_store_path=loom_store_path)
+ )
bdb.sql_execute('CREATE TABLE t (a, b, c, d, e)')
for a, b, c, d, e in itertools.product(*([range(2)]*4+[['x','y']])):
@@ -125,11 +128,12 @@ def generate_v_structured_data(N, np_prng):
@contextlib.contextmanager
def bdb_for_checking_cmi(backend, iterations):
+ with tempdir('bayeslite-loom') as loom_store_path:
with bayesdb_open(':memory:') as bdb:
- path = os.path.dirname(os.path.abspath(__file__))
bayesdb_register_backend(
bdb,
- LoomBackend(loom_store_path= path + '/tmp/loom.store'))
+ LoomBackend(loom_store_path=loom_store_path)
+ )
bdb.sql_execute('CREATE TABLE t (a, b, c)')
for row in generate_v_structured_data(1000, bdb.np_prng):
bdb.sql_execute('''
