Env fixes

* Do no-op when target promotion env is Library
* Add predicate to check whether env is a Library
Fix various tests that have problems with environments