Fix resource access

We cannot rely on load-file-name during test execution because by
documentation this variable is only defined while the file is loaded,
which is finished before the tests are actually executed.