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
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()
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)
def install_node_package(node_package): nodely.install(node_package)
def test_install_non_existent(): with pytest.raises(nodely.NodeCommandError): nodely.install('non-existent')
def test_install_non_existent(): with pytest.raises(RuntimeError): nodely.install('non-existent')