Skip to content

Commit

Permalink
Add test_push_(no_)ignore_error
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Dec 16, 2017
1 parent 1124ede commit 8808b54
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_blackhole.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,35 @@ def test_read_parse_json_commit(self):
assert parsed == dict(orig, heading=heading)


class TestCLIUnconfigured(MixInGitReposPerMethod, unittest.TestCase):

repos = ['local']

def setUp(self):
super(TestCLIUnconfigured, self).setUp()

self.orig_env = os.environ.copy()
os.environ.update(HOME=self.tmpdir)

self.orig_wd = os.getcwd()
os.chdir(self.tmppath('local'))

def tearDown(self):
os.chdir(self.orig_wd)
os.environ.clear()
os.environ.update(self.orig_env)

super(TestCLIUnconfigured, self).tearDown()

def test_push_no_ignore_error(self):
with pytest.raises(SystemExit) as excinfo:
main(['push'])
assert excinfo.value.code == 1

def test_push_ignore_error(self):
main(['push', '--ignore-error'])


def get_subcommands():
parser = make_parser()
action = parser._subparsers._group_actions[0]
Expand Down

0 comments on commit 8808b54

Please sign in to comment.