2020-05-08 23:28:44 +00:00
|
|
|
import sys
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
sys.path.append(str(Path(__file__).parents[2]))
|
|
|
|
|
2020-05-09 00:06:22 +00:00
|
|
|
from pyodide_build.common import _parse_package_subset # noqa
|
2020-05-08 23:28:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_parse_package_subset():
|
2020-05-09 10:32:10 +00:00
|
|
|
assert _parse_package_subset(None) is None
|
2020-05-08 23:28:44 +00:00
|
|
|
# micropip is always included
|
2020-05-12 10:33:20 +00:00
|
|
|
assert _parse_package_subset("numpy,pandas") == {
|
2020-06-28 18:24:40 +00:00
|
|
|
"micropip",
|
|
|
|
"distlib",
|
|
|
|
"numpy",
|
|
|
|
"pandas",
|
2020-05-12 10:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# duplicates are removed
|
2020-06-28 18:24:40 +00:00
|
|
|
assert _parse_package_subset("numpy,numpy") == {"micropip", "distlib", "numpy"}
|
2021-03-20 18:00:35 +00:00
|
|
|
|
|
|
|
# no empty package name included, spaces are handled
|
|
|
|
assert _parse_package_subset("x, a, b, c ,,, d,,") == {
|
|
|
|
"micropip",
|
|
|
|
"distlib",
|
|
|
|
"x",
|
|
|
|
"a",
|
|
|
|
"b",
|
|
|
|
"c",
|
|
|
|
"d",
|
|
|
|
}
|