Exemplo n.º 1
0
def test_which(node_package, node_package_command):
    nodely.install(node_package)
    path = Path(nodely.NODE_MODULES_DIR / '.bin' / node_package_command)
    if WIN:  # pragma: no cover
        path += '.cmd'
    assert nodely.which(node_package_command).normcase() == path.normcase()
    assert nodely.which('non-existent') is None
Exemplo n.º 2
0
def test_install(node_package):
    node_package_dir = nodely.NODE_MODULES_DIR / node_package
    nodely.install(node_package)
    assert node_package_dir.isdir()
    nodely.uninstall(node_package)
    assert not node_package_dir.exists()
    nodely.install(node_package)
    assert node_package_dir.isdir()
Exemplo n.º 3
0
def require_node_modules(dist, keyword='require_node_modules', jsmodules=None):
    """
    Install required `jsmodules` during a Python package ``setup()``.
    """
    assert keyword == 'require_node_modules'
    if jsmodules is None:
        return

    if isstring(jsmodules):
        jsmodules = filter(None,
                           (mod.strip() for mod in jsmodules.split('\n')))
    for jsmod in jsmodules:
        nodely.install(jsmod)
Exemplo n.º 4
0
def install_node_package(node_package):
    nodely.install(node_package)
Exemplo n.º 5
0
def test_install_non_existent():
    with pytest.raises(nodely.NodeCommandError):
        nodely.install('non-existent')
Exemplo n.º 6
0
def test_install_non_existent():
    with pytest.raises(RuntimeError):
        nodely.install('non-existent')