finally figured out right way to do dependencies

This commit is contained in:
Silen Naihin
2023-06-25 00:22:53 -04:00
parent 2f28a66591
commit 06a6f08054
10 changed files with 36 additions and 14 deletions

View File

@@ -2,6 +2,7 @@ import pytest
from agbenchmark.Challenge import Challenge
@pytest.mark.run(order=1)
@pytest.mark.basic
class BasicChallenge(Challenge):
pass

View File

@@ -1,7 +1,9 @@
{
"category": ["basic"],
"task": "Write the string 'random string' before any existing text to the file called file_to_check.txt",
"dependencies": ["test_write_file"],
"dependencies": [
"agbenchmark/tests/basic_abilities/write_file/write_file_test.py::TestWriteFile::test_write_file"
],
"ground": {
"answer": "random string: this is how we're doing",
"should_contain": ["random string: this is how we're doing"],

View File

@@ -3,7 +3,6 @@ from agbenchmark.challenges.define_task_types import ChallengeData
from agbenchmark.Challenge import Challenge
from agbenchmark.tests.basic_abilities.BasicChallenge import BasicChallenge
import os
from pytest_dependency import depends
data = ChallengeData.deserialize(
os.path.join(os.path.dirname(__file__), "r_file_data.json")
@@ -26,9 +25,8 @@ class TestReadFile(BasicChallenge):
[(data.task, data.mock_func)],
indirect=True,
)
def test_read_file(self, request, workspace):
depends(request, data.dependencies)
@pytest.mark.order(after=data.dependencies)
def test_read_file(self, workspace):
file = self.open_file(workspace, data.ground.files[0])
score = self.scoring(file, data.ground)

View File

@@ -16,7 +16,6 @@ class TestWriteFile(BasicChallenge):
[(data.task, data.mock_func)],
indirect=True,
)
@pytest.mark.dependency()
def test_write_file(self, workspace):
file = self.open_file(workspace, data.ground.files[0])