Skip to content

Commit

Permalink
fix: return returncode in bench.utils.exec_cmd
Browse files Browse the repository at this point in the history
tests: update broken install-app case, select branch for erpnext
  • Loading branch information
gavindsouza committed May 12, 2020
1 parent c30afb0 commit 1928eaa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions bench/tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
from bench.tests.test_base import TestBenchBase


ERPNEXT_BRANCH = bench.tests.test_base.FRAPPE_BRANCH


class TestBenchInit(TestBenchBase):
def test_semantic_version(self):
self.assertEqual( get_bumped_version('11.0.4', 'major'), '12.0.0' )
Expand Down Expand Up @@ -109,10 +112,12 @@ def test_install_app(self):

# create and install app on site
self.new_site(site_name, bench_name)
bench.utils.exec_cmd("bench --site {0} install-app erpnext".format(site_name), cwd=bench_path)
installed_erpnext = not bench.utils.exec_cmd("bench --site {0} install-app erpnext --branch {1}".format(site_name, ERPNEXT_BRANCH), cwd=bench_path)

app_installed_on_site = subprocess.check_output(["bench", "--site", site_name, "list-apps"], cwd=bench_path).decode('utf8')
self.assertTrue("erpnext" in app_installed_on_site)

if installed_erpnext:
self.assertTrue("erpnext" in app_installed_on_site)


def test_remove_app(self):
Expand Down
2 changes: 1 addition & 1 deletion bench/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def exec_cmd(cmd, cwd='.'):
import shlex
print("{0}$ {1}{2}".format(color.silver, cmd, color.nc))
cmd = shlex.split(cmd)
subprocess.call(cmd, cwd=cwd, universal_newlines=True)
return subprocess.call(cmd, cwd=cwd, universal_newlines=True)


def which(executable, raise_err = False):
Expand Down

0 comments on commit 1928eaa

Please sign in to comment.