Beispiel #1
0
 def test__options_adds_options(self):
     crochet = Crochet()
     parser = OptionParser()
     crochet.options(parser=parser, env={})
     self.assertThat(
         parser.option_list[-2:],
         MatchesListwise([
             # The --with-crochet option.
             MatchesStructure.byEquality(
                 action="store_true",
                 default=None,
                 dest="enable_plugin_crochet",
             ),
             # The --crochet-no-setup option.
             MatchesStructure.byEquality(
                 action="store_true",
                 default=False,
                 dest="crochet_no_setup",
             ),
         ]))
Beispiel #2
0
    def test_configure_does_not_set_up_crochet_if_not_enabled(self):
        self.patch_autospec(crochet_module, "setup")
        self.patch_autospec(crochet_module, "no_setup")

        crochet = Crochet()
        parser = OptionParser()
        crochet.add_options(parser=parser, env={})
        options, rest = parser.parse_args([])
        crochet.configure(options, sentinel.conf)

        self.assertThat(crochet_module.setup, MockNotCalled())
        self.assertThat(crochet_module.no_setup, MockNotCalled())
Beispiel #3
0
    def test__configure_sets_up_crochet_with_no_setup_if_enabled(self):
        self.patch_autospec(crochet_module, "setup")
        self.patch_autospec(crochet_module, "no_setup")

        crochet = Crochet()
        parser = OptionParser()
        crochet.add_options(parser=parser, env={})
        options, rest = parser.parse_args(
            ["--with-crochet", "--crochet-no-setup"])
        crochet.configure(options, sentinel.conf)

        self.assertThat(crochet_module.setup, MockNotCalled())
        self.assertThat(crochet_module.no_setup, MockCalledOnceWith())