def test_install_with_packages_created(self): cmd = ["scream", "new", "com.packagea"] with chdir(self.TMP_DIR): # Add a package. with mock.patch.object(sys, "argv", cmd): with self.assertRaises(SystemExit) as err: scream.Scream() self.assertEqual(err.exception.code, 0) subprocess.call(["git", "add", "."]) with chdir(self.TMP_DIR): with mock.patch.object(sys, "argv", self.cmd): with self.assertRaises(SystemExit) as err: scream.Scream() self.assertEqual(err.exception.code, 0)
def test_test_no_packages_created(self): cmds = [self.test, self.test_package, self.test_all, self.test_dry] with chdir(self.TMP_DIR): for cmd in cmds: with mock.patch.object(sys, "argv", cmd): with self.assertRaises(SystemExit) as err: scream.Scream() self.assertEqual(err.exception.code, 0)
def test_cmd_b4_init_monorepo(self): test_command = ["scream", "test"] new_command = ["scream", "new", "company.packagea"] install_command = ["scream", "install", "company_packagea"] cmds = [test_command, new_command, install_command] with chdir(self.TMP_DIR): for cmd in cmds: with mock.patch.object(sys, "argv", cmd): with self.assertRaises(SystemExit) as err: scream.Scream() self.assertEqual(err.exception.code, 1)
def test_new_package(self): with chdir(self.TMP_DIR): with mock.patch.object(sys, "argv", self.cmd): with self.assertRaises(SystemExit) as err: scream.Scream() self.assertEqual(err.exception.code, 0)
def test_init_monorepo(self): with chdir(self.TMP_DIR): with mock.patch.object(sys, "argv", ["scream", "init"]): with self.assertRaises(SystemExit) as err: scream.Scream() self.assertEqual(err.exception.code, 0)
def test_scream_test_gracefully_handle_no_git(self): with chdir(self.TMP_DIR): with mock.patch.object(sys, "argv", ["scream", "test"]): with self.assertRaises(SystemExit): scream.Scream()