def test_paths(self):
        preprocessor = Extract()
        path, resources = Extract().preprocess(self.tmp_path, self.resources)
        path, resources = CreateFolderStructure().preprocess(path, resources)

        assert os.path.exists(
            os.path.join(self.tmp_path,
                         CreateFolderStructure().directory))

        for student in self.students:
            assert os.path.exists(
                os.path.join(self.tmp_path,
                             CreateFolderStructure().directory, student,
                             self.assignment))
    def test_rename(self):
        path, resources = Extract().preprocess(self.tmp_path, self.resources)
        path, resources = ExtractAssignmentInfo().preprocess(path, resources)
        path, resources = CreateFolderStructure().preprocess(path, resources)
        path, resources = RenameSubmission().preprocess(path, resources)

        for uid, student in self.submitted:
            assert os.path.exists(os.path.join(path, uid))
예제 #3
0
 def test_delete_full_tmp(self):
     path, resources = Extract().preprocess(self.tmp_path, self.resources)
     print(path)
     path, resources = CreateFolderStructure().preprocess(path, resources)
     print(path)
     path, resources = MoveToSubmitted().preprocess(path, resources)
     print(path)
     path, resources = DeleteTempFolders().preprocess(path, resources)
     assert not os.path.exists(self.tmp_path)
예제 #4
0
 def test_delete_partial(self):
     path, resources = Extract().preprocess(self.tmp_path, self.resources)
     extract_path = path
     assert os.path.exists(extract_path)
     path, resources = CreateFolderStructure().preprocess(path, resources)
     restructured_path = path
     assert os.path.exists(path)
     path, resources = DeleteTempFolders().preprocess(path, resources)
     assert not os.path.exists(extract_path)
     assert os.path.exists(restructured_path)
    def test_rename(self):
        path, resources = Extract().preprocess(self.tmp_path, self.resources)
        path, resources = ExtractAssignmentInfo().preprocess(path, resources)
        path, resources = CreateFolderStructure().preprocess(path, resources)
        path, resources = RenameNotebooks().preprocess(path, resources)

        for student in self.students:
            assert os.path.exists(os.path.join(path, student))
            for src_nb in resources['source_notebooks']:
                assert os.path.isfile(
                    os.path.join(path, student, self.assignment, src_nb))
예제 #6
0
    def test_rename(self):
        path, resources = Extract().preprocess(self.tmp_path, self.resources)
        path, resources = ExtractAssignmentInfo().preprocess(path, resources)
        path, resources = CreateFolderStructure().preprocess(path, resources)
        path, resources = AddExtraFiles().preprocess(path, resources)
        path, resources = RenameNotebooks().preprocess(path, resources)
        path, resources = RestructureSubmission().preprocess(path, resources)

        assert os.path.exists(path)
        assert os.path.isfile(
            os.path.join(self.tmp_path,
                         RestructureSubmission().directory, 'student2',
                         self.assignment, 'file.txt'))
    def test_other(self):
        path, resources = Extract().preprocess(self.tmp_path, self.resources)
        path, resources = ExtractAssignmentInfo().preprocess(path, resources)
        path, resources = CreateFolderStructure().preprocess(path, resources)
        path, resources = RenameNotebooks().preprocess(path, resources)

        assert os.path.isfile(
            os.path.join(path, 'student3', self.assignment,
                         'problem_set_two.ipynb'))
        assert os.path.isfile(
            os.path.join(path, 'student4', self.assignment, 'ps2.ipynb'))
        assert not os.path.isfile(
            os.path.join(path, 'student5', self.assignment,
                         'problem_set_one.ipynb'))
    def test_extra_files(self):
        path, resources = Extract().preprocess(self.tmp_path, self.resources)
        path, resources = ExtractAssignmentInfo().preprocess(path, resources)
        path, resources = CreateFolderStructure().preprocess(path, resources)
        path, resources = AddExtraFiles().preprocess(path, resources)

        assert os.path.exists(path)

        for student in self.students:
            assert os.path.exists(os.path.join(path, student))
            assert os.path.exists(
                os.path.join(path, student, self.assignment, 'data'))
            assert os.path.isfile(
                os.path.join(path, student, self.assignment, 'data',
                             'file.txt'))