From 43e170e02d0567e2c2f2d34d4b9263b8d494a19f Mon Sep 17 00:00:00 2001 From: Valmik Jangla Date: Sun, 17 Jul 2016 23:57:48 -0700 Subject: [PATCH] Added tests for remove-app --- bench/commands/make.py | 2 +- bench/tests/test_init.py | 19 +++++++++++++++++++ bench/utils.py | 1 - 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/bench/commands/make.py b/bench/commands/make.py index efc77d5e..ecfcec0a 100755 --- a/bench/commands/make.py +++ b/bench/commands/make.py @@ -39,7 +39,7 @@ def new_app(app_name): @click.command('remove-app') @click.argument('app-name') def remove_app(app_name): - "completely remove new app from bench" + "completely remove app from bench" from bench.app import remove_app remove_app(app_name) diff --git a/bench/tests/test_init.py b/bench/tests/test_init.py index 09ed25de..bf9374e1 100755 --- a/bench/tests/test_init.py +++ b/bench/tests/test_init.py @@ -116,6 +116,25 @@ class TestBenchInit(unittest.TestCase): out = subprocess.check_output(["bench", "--site", site_name, "list-apps"], cwd=bench_path) self.assertTrue("erpnext" in out) + + def test_remove_app(self): + site_name = "test-site-4.dev" + self.init_bench('test-bench') + + self.new_site(site_name) + bench_path = os.path.join(self.benches_path, "test-bench") + + # get app + bench.app.get_app("https://github.com/frappe/erpnext", "develop", bench_path=bench_path) + + self.assertTrue(os.path.exists(os.path.join(bench_path, "apps", "erpnext"))) + + # remove it + bench.app.remove_app("erpnext", bench_path=bench_path) + + self.assertFalse(os.path.exists(os.path.join(bench_path, "apps", "erpnext"))) + + def test_switch_to_branch(self): self.init_bench('test-bench') diff --git a/bench/utils.py b/bench/utils.py index d6cbc300..a94fd93c 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -77,7 +77,6 @@ def exec_cmd(cmd, cwd='.'): stderr = stdout = subprocess.PIPE else: stderr = stdout = None - print cmd p = subprocess.Popen(cmd, cwd=cwd, shell=True, stdout=stdout, stderr=stderr) if async: