def generate_validation_report_and_publish():
    """Calls for the creation of the validation report and uploads to final location."""
    with TemporaryDirectory() as tmp_directory:
        platform_validator = PlatformValidator(tmp_directory, True)
        platform_validator.render_results()
        if platform_validator.processing_error:
            raise Exception("Report generation failed")
        upload_directory(tmp_directory, "validation", configuration.get_value(ConfigurationVariable.AWS_BUCKET))
示例#2
0
 def test_multiple_temporary_dir_cleanup(self):
     tmp = TemporaryDirectory()
     self.assertTrue(tmp.path.exists())
     tmp.cleanup()
     self.assertFalse(tmp.path.exists())
     tmp.cleanup()
     self.assertFalse(tmp.path.exists())
示例#3
0
def generate_documentation(output_directory: Path,
                           module_to_document: str) -> None:
    """Ensures the documentation is in the correct location.

    Pdoc nests its docs output in a folder with the module's name.
    This process removes this unwanted folder.
    """
    _clear_previous_docs(output_directory)
    os.makedirs(str(output_directory), exist_ok=True)
    with TemporaryDirectory() as temp_dir:
        _call_pdoc(temp_dir, module_to_document)
        docs_contents_dir = temp_dir.joinpath(module_to_document)
        if docs_contents_dir.exists() and docs_contents_dir.is_dir():
            for element in docs_contents_dir.iterdir():
                shutil.move(str(element), str(output_directory))
示例#4
0
 def test_find_file_down_the_tree(self):
     filename = "test.test"
     with TemporaryDirectory() as temp_dir:
         child_dir = temp_dir
         for i in range(0, 10):
             child_dir = child_dir.joinpath(f"test{str(i)}")
             os.makedirs(child_dir)
         temp_file = Path(child_dir).joinpath(filename)
         temp_file.touch()
         with cd(str(temp_dir)):
             self.assertEqual(
                 temp_file,
                 Path(
                     find_file_in_tree(filename,
                                       starting_point=os.getcwd(),
                                       top=False)))
示例#5
0
 def test_temporary_directory(self):
     temp_dir_path = None
     temp_file_path = None
     with TemporaryDirectory() as temp_dir:
         self.assertIsNotNone(temp_dir)
         self.assertTrue(temp_dir.exists())
         temp_dir_path = temp_dir
         temp_file = temp_dir.joinpath("test.test")
         temp_file_path = temp_file
         self.assertFalse(temp_file.exists())
         temp_file.touch()
         self.assertTrue(temp_file.exists())
     self.assertIsNotNone(temp_dir_path)
     self.assertIsNotNone(temp_file_path)
     self.assertFalse(temp_file_path.exists())
     self.assertFalse(temp_dir_path.exists())
示例#6
0
 def test_cd(self):
     with TemporaryDirectory() as temp_dir:
         self.assertNotEqual(Path(os.getcwd()), temp_dir)
         with cd(temp_dir):
             self.assertEqual(Path(os.getcwd()), temp_dir)
         self.assertNotEqual(Path(os.getcwd()), temp_dir)