Skip to content

Commit

Permalink
✅ Ensure datasets and experiments are cleaned up after tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipedino committed Jan 13, 2025
1 parent 4875348 commit 62a89fb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
8 changes: 7 additions & 1 deletion tests/back/api/test_experiments_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ def create_dataset(client):
},
files={"file": ("filename", csv, "text/csv")},
)
return response.json()["id"]

dataset_id = response.json()["id"]

yield dataset_id

response = client.delete(f"/api/v1/dataset/{dataset_id}")
assert response.status_code == 204, response.text


@pytest.fixture(scope="module", name="response_1")
Expand Down
7 changes: 6 additions & 1 deletion tests/back/api/test_explainer_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ def create_dataset(client):
},
files={"file": ("filename", csv, "text/csv")},
)
return response.json()["id"]
dataset_id = response.json()["id"]

yield dataset_id

response = client.delete(f"/api/v1/dataset/{dataset_id}")
assert response.status_code == 204, response.text


class DummyTask(BaseTask):
Expand Down
12 changes: 10 additions & 2 deletions tests/back/api/test_runs_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ def create_dataset(client):
},
files={"file": ("filename", csv, "text/csv")},
)
return response.json()["id"]
dataset_id = response.json()["id"]

yield response.json()["id"]

response = client.delete(f"/api/v1/dataset/{dataset_id}")
assert response.status_code == 204, response.text


@pytest.fixture(scope="module", name="experiment_id")
Expand Down Expand Up @@ -61,7 +66,10 @@ def create_experiment(client: TestClient, dataset_id):
),
},
)
return response.json()["id"]

yield response.json()["id"]
response = client.delete(f"/api/v1/experiment/{response.json()['id']}")
assert response.status_code == 204, response.text


def test_create_run(client: TestClient, experiment_id: int):
Expand Down

0 comments on commit 62a89fb

Please sign in to comment.