Is it possible to restrict inline tests to a specific package in a multi-package dune project?

If I have a dune runtest alias, I can include a package field to only use the alias when building that package.

For example, if I have a package aplus that depends on package a in the same repo, I don’t want to try to run the tests for aplus when just installing a. So I can write (package aplus) in the rule definition to say that I should only run those tests when I’m actually trying to build aplus.

Is there a way to do this for inline tests?

It is not at the moment. It is a known limitation. One idea @rgrinberg mentioned in the past is to have one package per directory. i.e. instead of flagging stanzas with (package a), you’d just say that “directory a correspond to package a”, and everything under a/ would be part of package a.