class TestArgParser:
    def __init__(self):
        self.is_setup = False
        self.parser = None

    def setUp(self):
        assert not self.is_setup
        self.parser = Parser()
        self.is_setup = True

    def tearDown(self):
        assert self.is_setup
        self.parser = None
        self.is_setup = False

    def test_parse_args_empty(self):
        args = self.parser.parse_args([])
        assert args.module is None
        assert args.config is None

    def test_parse_args_full(self):
        args = self.parser.parse_args(["-m", "wraptest", "-c", "wrap.cfg"])
        assert args.module == "wraptest"
        assert args.config == "wrap.cfg"

    # These assume no wrap.cfg was found in the main repo.
    def test_parse_config_empty(self):
        args = self.parser.parse_args([])
        assert_raises(IOError, self.parser.parse_config, args)

    def test_parse_config_bad_path(self):
        args = self.parser.parse_args(["-c", "bad.cfg"])
        assert_raises(IOError, self.parser.parse_config, args)

    def test_parse_config_good_path(self):
        file = path.join(getcwd(), "wraptest/tests/test.cfg")
        args = self.parser.parse_args(["-c", file])
        self.parser.parse_config(args)
        assert format_conf() is not {}
 def setUp(self):
     assert not self.is_setup
     self.parser = Parser()
     self.is_setup = True