clan-cli/tests: fixup imports
This commit is contained in:
parent
875ee61aa0
commit
7f937077cf
@ -1,11 +1,11 @@
|
|||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import clan_admin
|
from clan_cli import admin
|
||||||
|
|
||||||
|
|
||||||
def test_make_parser():
|
def test_make_parser():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
clan_admin.make_parser(parser)
|
admin.register_parser(parser)
|
||||||
|
|
||||||
|
|
||||||
# using fp fixture from pytest-subprocess
|
# using fp fixture from pytest-subprocess
|
||||||
@ -13,5 +13,5 @@ def test_create(fp):
|
|||||||
cmd = ["nix", "flake", "init", "-t", fp.any()]
|
cmd = ["nix", "flake", "init", "-t", fp.any()]
|
||||||
fp.register(cmd)
|
fp.register(cmd)
|
||||||
args = argparse.Namespace(folder="./my-clan")
|
args = argparse.Namespace(folder="./my-clan")
|
||||||
clan_admin.create(args)
|
admin.create(args)
|
||||||
assert fp.call_count(cmd) == 1
|
assert fp.call_count(cmd) == 1
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import clan
|
import clan_cli
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
def test_no_args(capsys):
|
def test_no_args(capsys):
|
||||||
clan.clan()
|
clan_cli.main()
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert captured.out.startswith("usage:")
|
assert captured.out.startswith("usage:")
|
||||||
|
|
||||||
@ -13,6 +13,6 @@ def test_no_args(capsys):
|
|||||||
def test_help(capsys, monkeypatch):
|
def test_help(capsys, monkeypatch):
|
||||||
monkeypatch.setattr(sys, "argv", ["", "--help"])
|
monkeypatch.setattr(sys, "argv", ["", "--help"])
|
||||||
with pytest.raises(SystemExit):
|
with pytest.raises(SystemExit):
|
||||||
clan.clan()
|
clan_cli.main()
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert captured.out.startswith("usage:")
|
assert captured.out.startswith("usage:")
|
||||||
|
Loading…
Reference in New Issue
Block a user