def test_file_remove(self):
     _file = tempfile.NamedTemporaryFile(delete=False)
     _file.close()
     remove(_file.name)
     self.assertFalse(os.path.exists(_file.name))
     # No Exception thrown
     remove(os.path.join(os.getcwd(), "random"))
def _package_schemas_code(runtime, schemas_api_caller, schema_template_details, output_dir, name, location):
    try:
        click.echo("Trying to get package schema code")
        download_location = tempfile.NamedTemporaryFile(delete=False)
        do_download_source_code_binding(runtime, schema_template_details, schemas_api_caller, download_location)
        do_extract_and_merge_schemas_code(download_location, output_dir, name, location)
        download_location.close()
    except (ClientError, WaiterError) as e:
        raise SchemasApiException("Exception occurs while packaging Schemas code. %s" % e.response["Error"]["Message"])
    finally:
        remove(download_location.name)
Esempio n. 3
0
 def tearDown(self):
     delattr(_local, "stack")
     remove(self.samconfig_path)