Thanks to visit codestin.com
Credit goes to github.com

Skip to content

In Windows tests, unlinking test DB does not work #62

@andybega

Description

@andybega

On Windows, the test database set up for testthat sometimes does not get deleted when calling unlink(). I have no idea why.

This is specifically when using setup_mock_environment(), which creates the test database as test.sqlite3. Unlinking this file for some reason does not work on Windows, which causes an error the next time setup_mock_environment() is called.

As a fix, I'm changing setup_mock_environment() to randomly name the test database. That way even if the previous instance cannot be deleted, a new one can be created the next time setup_mock_environment() is called.

There should after this be one test error remaining, when remove_db() is tested. Here the file really needs to be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions