Ideally the tests wouldn't touch the default data directory. Both the core unit tests and the functional tests do this correctly. However, src/qt/test/test_bitcoin-qt seems to create an empty ~/.bitcoin directory if it doesn't exist yet.
Instead, it should set up a temporary data directory like the other tests.