The test should be run using the wrapper run-tests.sh. This links the tests into the normal notmuch TEST_DIRECTORY and runs them from there. After the test is complete then the links are removed.