Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_restore(capsys):
main("restore")
assert client.installed() == ["htm", "react", "react-dom"]
def test_install_with_exports(capsys):
client.delete_web_modules(["preact", "preact/hooks"], skip_missing=True)
main("install", "preact", "--exports", "preact/hooks")
assert client.web_module_exists("preact/hooks")
main("installed")
captured = capsys.readouterr()
assert "- preact" in captured.out
assert "- preact/hooks" in captured.out
main("uninstall", "preact")
assert not client.web_module_exists("preact/hooks")
main("installed")
captured = capsys.readouterr()
assert "- preact" not in captured.out
assert "- preact/hooks" not in captured.out
def test_bad_options(capsys, args, error):
with pytest.raises(type(error), match=str(error)):
main("--debug", *args)
with pytest.raises(SystemExit):
main(*args)
def test_simple_install(capsys):
client.delete_web_modules("jquery", skip_missing=True)
main("install", "jquery")
assert client.web_module_exists("jquery")
main("installed")
captured = capsys.readouterr()
assert "- jquery" in captured.out
with assert_file_is_touched(client.web_module_path("jquery")):
main("install", "jquery", "--force")
assert client.web_module_exists("jquery")
main("uninstall", "jquery")
assert not client.web_module_exists("jquery")
def test_simple_install(capsys):
client.delete_web_modules("jquery", skip_missing=True)
main("install", "jquery")
assert client.web_module_exists("jquery")
main("installed")
captured = capsys.readouterr()
assert "- jquery" in captured.out
with assert_file_is_touched(client.web_module_path("jquery")):
main("install", "jquery", "--force")
assert client.web_module_exists("jquery")
main("uninstall", "jquery")
assert not client.web_module_exists("jquery")
def test_bad_options(capsys, args, error):
with pytest.raises(type(error), match=str(error)):
main("--debug", *args)
with pytest.raises(SystemExit):
main(*args)
def test_simple_install(capsys):
client.delete_web_modules("jquery", skip_missing=True)
main("install", "jquery")
assert client.web_module_exists("jquery")
main("installed")
captured = capsys.readouterr()
assert "- jquery" in captured.out
with assert_file_is_touched(client.web_module_path("jquery")):
main("install", "jquery", "--force")
assert client.web_module_exists("jquery")
main("uninstall", "jquery")
assert not client.web_module_exists("jquery")
def test_simple_install(capsys):
client.delete_web_modules("jquery", skip_missing=True)
main("install", "jquery")
assert client.web_module_exists("jquery")
main("installed")
captured = capsys.readouterr()
assert "- jquery" in captured.out
with assert_file_is_touched(client.web_module_path("jquery")):
main("install", "jquery", "--force")
assert client.web_module_exists("jquery")
main("uninstall", "jquery")
assert not client.web_module_exists("jquery")
def test_install_with_exports(capsys):
client.delete_web_modules(["preact", "preact/hooks"], skip_missing=True)
main("install", "preact", "--exports", "preact/hooks")
assert client.web_module_exists("preact/hooks")
main("installed")
captured = capsys.readouterr()
assert "- preact" in captured.out
assert "- preact/hooks" in captured.out
main("uninstall", "preact")
assert not client.web_module_exists("preact/hooks")
main("installed")
captured = capsys.readouterr()
assert "- preact" not in captured.out
assert "- preact/hooks" not in captured.out
def test_install_with_exports(capsys):
client.delete_web_modules(["preact", "preact/hooks"], skip_missing=True)
main("install", "preact", "--exports", "preact/hooks")
assert client.web_module_exists("preact/hooks")
main("installed")
captured = capsys.readouterr()
assert "- preact" in captured.out
assert "- preact/hooks" in captured.out
main("uninstall", "preact")
assert not client.web_module_exists("preact/hooks")
main("installed")
captured = capsys.readouterr()
assert "- preact" not in captured.out
assert "- preact/hooks" not in captured.out