Skip to content

Test failures can trigger unrelated test failures #2654

Closed
@ElDeveloper

Description

@ElDeveloper

Since not all test classes cleanup the database, some tests follow a pattern where they first test the matter at hand, and then do any cleanup that may be needed. This is fine if the test passes, however if the test fails the cleanup won't happen and the database may be in an inconsistent state (or a different state from what other tests expect).

For example in qiita_db/test_study.py the TestStudy class does something along the lines of:

def test_get_info(self):
    # 1.- do some testing
    self.assert.....
    # 2.- create a new study
    Study.create(....)
    # 3.- do additional testing
    self.assert......
    # 4.- delete the additional study
    Study.delete(......)

Ideally, the created studies or created objects should be deleted in the tearDown class (to guarantee that the studies are cleaned up).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions