-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add BrewfileTestLinux for Linux-specific tests
test: update Brewfile input handling based on OS test: conditionally assert Linux and macOS specific brew inputs test: ensure correct output for Linux files during write
- Loading branch information
Showing
2 changed files
with
41 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Before commands | ||
before echo before | ||
|
||
# tap repositories and their packages | ||
|
||
tap homebrew/core | ||
brew [email protected] | ||
brew vim --HEAD | ||
|
||
# Main file | ||
main BrewfileMain | ||
|
||
# Additional files | ||
file BrewfileExt | ||
file BrewfileExt2 | ||
file BrewfileNotExist | ||
file ~/BrewfileHomeForTestingNotExists | ||
|
||
# Other commands | ||
echo other commands | ||
|
||
# After commands | ||
after echo after |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,9 @@ | |
|
||
@pytest.fixture | ||
def brew_info(): | ||
file = "BrewfileTest" if brew_file.is_mac() else "BrewfileTestLinux" | ||
bf = brew_file.BrewFile( | ||
{"input": Path(__file__).parent / "files" / "BrewfileTest"} | ||
{"input": Path(__file__).parent / "files" / file} | ||
) | ||
return bf.brewinfo | ||
|
||
|
@@ -254,13 +255,18 @@ def test_read(brew_info): | |
brew_info.read() | ||
assert brew_info.brew_input_opt == {"[email protected]": "", "vim": " --HEAD"} | ||
assert brew_info.brew_input == ["[email protected]", "vim"] | ||
assert brew_info.tap_input == [ | ||
"homebrew/core", | ||
"homebrew/cask", | ||
"rcmdnk/rcmdnkcask", | ||
] | ||
assert brew_info.cask_input == ["iterm2", "font-migu1m"] | ||
assert brew_info.appstore_input == ["Keynote"] | ||
if brew_file.is_mac(): | ||
assert brew_info.tap_input == [ | ||
"homebrew/core", | ||
"homebrew/cask", | ||
"rcmdnk/rcmdnkcask", | ||
] | ||
assert brew_info.cask_input == ["iterm2", "font-migu1m"] | ||
assert brew_info.appstore_input == ["Keynote"] | ||
else: | ||
assert brew_info.tap_input == [ | ||
"homebrew/core", | ||
] | ||
assert brew_info.main_input == ["BrewfileMain"] | ||
assert brew_info.file_input == [ | ||
"BrewfileMain", | ||
|
@@ -318,26 +324,18 @@ def test_write(brew_info, tmp_path, tap): | |
brew_info.write() | ||
with open(default_file) as f1: | ||
default_txt = f1.readlines() | ||
if not brew_file.is_mac(): | ||
default_txt = [ | ||
x | ||
for x in default_txt | ||
if not x.startswith("cask ") and not x.startswith("appstore ") | ||
] | ||
default_txt = "".join(default_txt) | ||
if not brew_file.is_mac(): | ||
default_txt = default_txt.replace( | ||
"# App Store applications\n\n", "" | ||
) | ||
with open(tmp_file) as f2: | ||
tmp_txt = f2.read() | ||
assert tmp_txt == default_txt | ||
brew_info.helper.opt["form"] = "bundle" | ||
brew_info.write() | ||
if brew_file.is_mac(): | ||
cask_tap = "tap 'homebrew/cask'\n\ntap 'rcmdnk/rcmdnkcask'\n" | ||
appstore1 = "\n# App Store applications\nmas '', id: Keynote\n" | ||
appstore2 = "\n# App Store applications\nmas install Keynote\n" | ||
else: | ||
cask_tap = "" | ||
appstore1 = "" | ||
appstore2 = "" | ||
|
||
|
@@ -350,11 +348,7 @@ def test_write(brew_info, tmp_path, tap): | |
# tap repositories and their packages | ||
tap 'homebrew/core' | ||
tap 'homebrew/cask' | ||
tap 'rcmdnk/rcmdnkcask' | ||
{appstore1} | ||
{cask_tap}{appstore1} | ||
# Main file | ||
#main 'BrewfileMain' | ||
|
@@ -396,11 +390,7 @@ def test_write(brew_info, tmp_path, tap): | |
# tap repositories and their packages | ||
brew tap homebrew/core | ||
brew tap homebrew/cask | ||
brew tap rcmdnk/rcmdnkcask | ||
{appstore2} | ||
{cask_tap}{appstore2} | ||
# Main file | ||
#main BrewfileMain | ||
|