Skip to content

Commit 5dddfcb

Browse files
committed
add more voila bundle test
1 parent 82315e5 commit 5dddfcb

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

tests/test_bundle.py

+63
Original file line numberDiff line numberDiff line change
@@ -1278,3 +1278,66 @@ def test_make_voila_bundle_multi_notebook(
12781278
reqs = tar.extractfile("requirements.txt").read()
12791279
assert reqs == b"bqplot"
12801280
assert ans == json.loads(tar.extractfile("manifest.json").read().decode("utf-8"))
1281+
1282+
1283+
@pytest.mark.parametrize(
1284+
(
1285+
"path",
1286+
"entrypoint",
1287+
),
1288+
[
1289+
(
1290+
dashboard_dir,
1291+
dashboard_ipynb,
1292+
),
1293+
],
1294+
)
1295+
def test_make_voila_bundle_2(
1296+
path,
1297+
entrypoint,
1298+
):
1299+
environment = Environment(
1300+
conda=None,
1301+
contents="numpy\nipywidgets\nbqplot\n",
1302+
error=None,
1303+
filename="requirements.txt",
1304+
locale="en_US.UTF-8",
1305+
package_manager="pip",
1306+
pip="23.0",
1307+
python="3.8.12",
1308+
source="file",
1309+
)
1310+
ans = {
1311+
"version": 1,
1312+
"locale": "en_US.UTF-8",
1313+
"metadata": {"appmode": "jupyter-voila", "entrypoint": "dashboard.ipynb"},
1314+
"python": {
1315+
"version": "3.8.12",
1316+
"package_manager": {"name": "pip", "version": "23.0", "package_file": "requirements.txt"},
1317+
},
1318+
"files": {
1319+
"requirements.txt": {"checksum": "d51994456975ff487749acc247ae6d63"},
1320+
"bqplot.ipynb": {"checksum": "79f8622228eded646a3038848de5ffd9"},
1321+
"dashboard.ipynb": {"checksum": "6b42a0730d61e5344a3e734f5bbeec25"},
1322+
},
1323+
}
1324+
with make_voila_bundle(
1325+
path,
1326+
entrypoint,
1327+
extra_files=None,
1328+
excludes=None,
1329+
force_generate=True,
1330+
environment=environment,
1331+
image=None,
1332+
multi_notebook=False,
1333+
) as bundle, tarfile.open(mode="r:gz", fileobj=bundle) as tar:
1334+
names = sorted(tar.getnames())
1335+
assert names == [
1336+
"bqplot.ipynb",
1337+
"dashboard.ipynb",
1338+
"manifest.json",
1339+
"requirements.txt",
1340+
]
1341+
reqs = tar.extractfile("requirements.txt").read()
1342+
assert reqs == b"numpy\nipywidgets\nbqplot\n"
1343+
assert ans == json.loads(tar.extractfile("manifest.json").read().decode("utf-8"))

0 commit comments

Comments
 (0)