How to add an attribute to the body tag with a plugin?

Is there any way to add an attribute to the body tag?

For example:

<body test-attribute> 

Obviously this can be easily edited in the theme, but I’m trying to figure out how to add it with a plugin.