In particular, I want to create a custom field for Task for a specific unit test, then delete that field when the test is finished.
I know Salesforce uses the Metadata API, but this seems designed to be used externally (via REST or SOAP web services).
I am also aware that there is a separate development, APEX Metadata API, that allows us to access said API via Apex (by making Web service calls!): https://github.com/financialforcedev/apex-mdapi
Is there a way of calling into the Metadata API natively? Or, to make the problem scope smaller, can I create/delete custom Task fields via APEX?
Thanks
Edit: there seems to be some confusion as to why I want to do this. Basically, I'm creating a managed package, which can be installed by different customers in their respective orgs. Each and every org will be customised in a different way, so I cannot make any assumption as to what these customisations will be.
What I want to test is how a certain part of my code that deals with tasks will behave in the presence of some custom fields. That is why I wanted to create a field, run my code, then delete the field, in the context of a unit test.
I considered the question answered, as 2 people have come back to me telling me that I cannot modify metadata from APEX.