Exemplo n.º 1
0
 def test_argument_is_file(self):
     self._check_argument(
         'existing-file',
         sds_test.Arrangement(sds_contents_before=contents_in(
             RelSdsOptionType.REL_ACT,
             DirContents([File.empty('existing-file')]))),
         sds_test.Expectation(expected_action_result=is_failure()))
Exemplo n.º 2
0
 def test_act_root_option_should_change_to_act_dir__dot_arg(self):
     self._check_argument(
         format_rel_options('{rel_act} .'),
         sds_test.Arrangement(
             pre_action_action=ChangeDirTo(lambda sds: sds.root_dir)),
         sds_test.Expectation(
             expected_action_result=is_success(),
             post_action_check=CwdIs(lambda sds: sds.act_dir)))
Exemplo n.º 3
0
 def test_relative_tmp__with_argument(self):
     self._check_argument(
         format_rel_options('{rel_tmp} sub1/sub2'),
         sds_test.Arrangement(sds_contents_before=contents_in(
             RelSdsOptionType.REL_TMP,
             DirContents([Dir('sub1', [Dir.empty('sub2')])]))),
         sds_test.Expectation(
             expected_action_result=is_success(),
             post_action_check=CwdIs(
                 lambda sds: sds.user_tmp_dir / 'sub1' / 'sub2')))
Exemplo n.º 4
0
 def test_single_dot_argument_should_have_no_effect(self):
     self._check_argument(
         '.',
         sds_test.Arrangement(pre_action_action=ChangeDirTo(
             lambda sds: sds.act_dir / 'sub-dir'),
                              sds_contents_before=contents_in(
                                  RelSdsOptionType.REL_ACT,
                                  DirContents([Dir.empty('sub-dir')]))),
         sds_test.Expectation(
             expected_action_result=is_success(),
             post_action_check=CwdIs(lambda sds: sds.act_dir / 'sub-dir')))
Exemplo n.º 5
0
 def test_relative_argument_should_change_dir_relative_to_cwd__from_act_dir(
         self):
     self._check_argument(
         'existing-dir',
         sds_test.Arrangement(sds_contents_before=contents_in(
             RelSdsOptionType.REL_ACT,
             DirContents([Dir.empty('existing-dir')]))),
         sds_test.Expectation(
             expected_action_result=is_success(),
             post_action_check=CwdIs(
                 lambda sds: sds.act_dir / 'existing-dir')))
Exemplo n.º 6
0
 def test_relative_argument_should_change_dir_relative_to_cwd__from_tmp_dir(
         self):
     self._check_argument(
         'sub1/sub2',
         sds_test.Arrangement(
             sds_contents_before=contents_in(
                 RelSdsOptionType.REL_TMP,
                 DirContents([Dir('sub1', [Dir.empty('sub2')])])),
             pre_action_action=ChangeDirTo(lambda sds: sds.user_tmp_dir)),
         sds_test.Expectation(
             expected_action_result=is_success(),
             post_action_check=CwdIs(
                 lambda sds: sds.user_tmp_dir / 'sub1' / 'sub2')))
Exemplo n.º 7
0
 def test_relative_result__after_act_phase(self):
     self._check_argument_for_single_case(
         True, format_rel_options('{rel_result} .'), sds_test.Arrangement(),
         sds_test.Expectation(
             expected_action_result=is_success(),
             post_action_check=CwdIs(lambda sds: sds.result.root_dir)))
Exemplo n.º 8
0
 def test_relative_tmp__with_argument__dot_arg(self):
     self._check_argument(
         format_rel_options('{rel_tmp} .'), sds_test.Arrangement(),
         sds_test.Expectation(
             expected_action_result=is_success(),
             post_action_check=CwdIs(lambda sds: sds.user_tmp_dir)))