Skip to content

Commit

Permalink
test: fix test for ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmdnk committed Feb 12, 2023
1 parent 8d46c0b commit 577ddfb
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions tests/test_brew_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,6 @@ def set_func(func):
"clean",
"check_repo () {}\ncheck_input_file () {}\ncleanup () {}\n", # noqa: P103
),
(
"update",
"check_repo () {}\ncheck_input_file () {}\nproc ('brew update',) {'dryrun': False}\nproc ('brew upgrade --fetch-HEAD',) {'dryrun': False}\nproc ('brew upgrade --cask',) {'dryrun': False}\ninstall () {}\ncleanup () {}\ninitialize () {'check': False}\n", # noqa: P103
),
],
)
def test_execute(execute_fixture, capsys, command, out):
Expand All @@ -536,6 +532,23 @@ def test_execute(execute_fixture, capsys, command, out):
assert captured.out == out


def test_execute_update(execute_fixture, capsys):
bf = execute_fixture
bf.opt["command"] = "update"
bf.execute()
captured = capsys.readouterr()
if brew_file.is_mac():
assert (
captured.out
== "check_repo () {}\ncheck_input_file () {}\nproc ('brew update',) {'dryrun': False}\nproc ('brew upgrade --fetch-HEAD',) {'dryrun': False}\nproc ('brew upgrade --cask',) {'dryrun': False}\ninstall () {}\ncleanup () {}\ninitialize () {'check': False}\n" # noqa: P103
)
else:
assert (
captured.out
== "check_repo () {}\ncheck_input_file () {}\nproc ('brew update',) {'dryrun': False}\nproc ('brew upgrade --fetch-HEAD',) {'dryrun': False}\ninstall () {}\ncleanup () {}\ninitialize () {'check': False}\n" # noqa: P103
)


def test_execute_err(execute_fixture):
bf = execute_fixture
bf.opt["command"] = "wrong_command"
Expand Down

0 comments on commit 577ddfb

Please sign in to comment.