def test_arrangement_and_expectation_of_home_dir_contents(self):
     home_dir_contents = DirContents([empty_file('file-name.txt')])
     self._check(
         PARSER_THAT_GIVES_SUCCESSFUL_INSTRUCTION,
         single_line_source(),
         ArrangementWithSds(
             hds_contents=case_home_dir_contents(home_dir_contents)),
         sut.Expectation(
             side_effects_on_home=f_asrt.dir_contains_exactly(home_dir_contents)),
     )
예제 #2
0
 def test_arrangement_and_expectation_of_hds_dir_contents(self):
     home_dir_contents = DirContents([File.empty('file-name.txt')])
     self._check_source_and_exe_variants(
         PARSER_THAT_GIVES_SUCCESSFUL_INSTRUCTION,
         Arrangement.phase_agnostic(
             tcds=TcdsArrangement(
                 hds_contents=hds_case_dir_contents(home_dir_contents)),
         ),
         MultiSourceExpectation.phase_agnostic(
             side_effects_on_hds=f_asrt.dir_contains_exactly(home_dir_contents)),
     )
예제 #3
0
def assert_dir_contains_exactly_result_files(expected: SubProcessResult,
                                             file_names: FileNames = process_output_files.FILE_NAMES
                                             ) -> Assertion:
    return fa.dir_contains_exactly(DirContents([
        File(file_names.exit_code,
             str(expected.exitcode)),
        File(file_names.stdout,
             expected.stdout),
        File(file_names.stderr,
             expected.stderr),
    ]))
예제 #4
0
    def test_that_populator_is_applied(self):
        # ARRANGE #
        expected_dir_contents = fs.DirContents([fs.File('file-name.txt', 'file contents')])
        populator = hds_populators.hds_case_dir_contents(expected_dir_contents)
        expectation = f_asrt.dir_contains_exactly(expected_dir_contents)

        # ACT #
        with home_directory_structure(contents=populator) as hds:
            # ASSERT #
            expectation.apply_with_message(self, hds.case_dir,
                                           'contents of home/case dir')
예제 #5
0
    def test_that_populator_is_applied(self):
        # ARRANGE #
        expected_dir_contents = fs.DirContents([fs.File('file-name.txt', 'file contents')])
        populator = home_populators.case_home_dir_contents(expected_dir_contents)
        expectation = f_asrt.dir_contains_exactly(expected_dir_contents)

        # ACT #
        with home_directory_structure(contents=populator) as hds:
            # ASSERT #
            expectation.apply_with_message(self, hds.case_dir,
                                           'contents of home/case dir')
예제 #6
0
    def test_no_populators_populate_hds(self):
        # ARRANGE #
        expected_dir_contents = fs.DirContents([])
        populator = sut.multiple([])
        expectation = f_asrt.dir_contains_exactly(expected_dir_contents)

        with home_directory_structure() as hds:
            # ACT #
            populator.populate_hds(hds)
            # ASSERT #
            expectation.apply_with_message(self, hds.case_dir,
                                           'contents of home/case dir')
예제 #7
0
    def test_populate_hds(self):
        # ARRANGE #
        expected_dir_contents = fs.DirContents([fs.File('file-name.txt', 'file contents')])
        populator = sut.hds_case_dir_contents(expected_dir_contents)
        expectation = f_asrt.dir_contains_exactly(expected_dir_contents)

        with home_directory_structure() as hds:
            # ACT #
            populator.populate_hds(hds)
            # ASSERT #
            expectation.apply_with_message(self, hds.case_dir,
                                           'contents of HDS/case dir')
예제 #8
0
    def test_no_populators_populate_hds(self):
        # ARRANGE #
        expected_dir_contents = fs.DirContents([])
        populator = sut.multiple([])
        expectation = f_asrt.dir_contains_exactly(expected_dir_contents)

        with home_directory_structure() as hds:
            # ACT #
            populator.populate_hds(hds)
            # ASSERT #
            expectation.apply_with_message(self, hds.case_dir,
                                           'contents of HDS/case dir')
예제 #9
0
    def test_populate_hds(self):
        # ARRANGE #
        expected_dir_contents = fs.DirContents([fs.File('file-name.txt', 'file contents')])
        populator = sut.contents_in(RelHomeOptionType.REL_HOME_CASE,
                                    expected_dir_contents)
        expectation = f_asrt.dir_contains_exactly(expected_dir_contents)

        with home_directory_structure() as hds:
            # ACT #
            populator.populate_hds(hds)
            # ASSERT #
            expectation.apply_with_message(self, hds.case_dir,
                                           'contents of home/case dir')
예제 #10
0
    def test_populate_home_or_sds(self):
        # ARRANGE #
        expected_dir_contents = fs.DirContents([fs.File('a-file-name.txt', 'the file contents')])
        populator = sut.case_home_dir_contents(expected_dir_contents)
        expectation = f_asrt.dir_contains_exactly(expected_dir_contents)

        sds = fake_sds()
        with home_directory_structure() as hds:
            home_and_sds = HomeAndSds(hds, sds)
            # ACT #
            populator.populate_home_or_sds(home_and_sds)
            # ASSERT #
            expectation.apply_with_message(self, hds.case_dir,
                                           'contents of home/case dir')
예제 #11
0
    def test_populate_tcds(self):
        # ARRANGE #
        expected_dir_contents = fs.DirContents([fs.File('a-file-name.txt', 'the file contents')])
        populator = sut.contents_in(RelHdsOptionType.REL_HDS_CASE,
                                    expected_dir_contents)
        expectation = f_asrt.dir_contains_exactly(expected_dir_contents)

        sds = fake_sds()
        with home_directory_structure() as hds:
            tcds = TestCaseDs(hds, sds)
            # ACT #
            populator.populate_tcds(tcds)
            # ASSERT #
            expectation.apply_with_message(self, hds.case_dir,
                                           'contents of HDS/case dir')
예제 #12
0
    def test_two_populators_populate_hds(self):
        # ARRANGE #
        expected_dir_contents = fs.DirContents([self.first_file,
                                                self.second_file])
        first_populator = sut.hds_case_dir_contents(fs.DirContents([self.first_file]))
        second_populator = sut.hds_case_dir_contents(fs.DirContents([self.second_file]))
        populator = sut.multiple([first_populator,
                                  second_populator])
        expectation = f_asrt.dir_contains_exactly(expected_dir_contents)

        with home_directory_structure() as hds:
            # ACT #
            populator.populate_hds(hds)
            # ASSERT #
            expectation.apply_with_message(self, hds.case_dir,
                                           'contents of HDS/case dir')
예제 #13
0
    def test_two_populators_populate_home_or_sds(self):
        # ARRANGE #
        expected_dir_contents = fs.DirContents([self.first_file,
                                                self.second_file])
        first_populator = sut.case_home_dir_contents(fs.DirContents([self.first_file]))
        second_populator = sut.case_home_dir_contents(fs.DirContents([self.second_file]))
        populator = sut.multiple([first_populator,
                                  second_populator])
        expectation = f_asrt.dir_contains_exactly(expected_dir_contents)

        sds = fake_sds()
        with home_directory_structure() as hds:
            home_and_sds = HomeAndSds(hds, sds)
            # ACT #
            populator.populate_home_or_sds(home_and_sds)
            # ASSERT #
            expectation.apply_with_message(self, hds.case_dir,
                                           'contents of home/case dir')