Skip to content

Add async support for class tearDown() function #415

@shepazon

Description

@shepazon

While we now have async versions of the per-test setUp() and tearDown() functions, we don't yet have an async version of the class-wide tearDown(). Adding this would allow tests that are able to ensure that any artifacts left behind by the main testing are cleaned up before the test suite ends:

override class func tearDown() async {
    super.tearDown()

    do {
        await someCleanupFunction()
    } catch {
        /* do error handling */
    }
}

I've tried using a Task() and a semaphore in the class tearDown(), but the task gets terminated early when the main test program exits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions