Skip to content

Commit 30ab232

Browse files
committed
fix(browser): pass filename to testcase constructor
1 parent bb4765a commit 30ab232

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

src/autobisect/evaluators/browser/browser.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,7 @@ def launch(
183183
raise BrowserEvaluatorException(f"Binary path does not exist ({binary})!")
184184

185185
# Create testcase
186-
if scan_dir:
187-
testcase = TestCase.load(test_path.parent, catalog=scan_dir)
188-
testcase.entry_point = str(test_path)
189-
else:
190-
testcase = TestCase.load(test_path, catalog=scan_dir)
186+
testcase = TestCase.load(test_path.parent, test_path, catalog=scan_dir)
191187

192188
if self.env_vars:
193189
for key, value in self.env_vars.items():

tests/evaluators/browser/test_browser.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from autobisect.evaluators import BrowserEvaluator, EvaluatorResult
1313
from autobisect.evaluators.browser.browser import BrowserEvaluatorException
14+
from grizzly.common.storage import TestCase
1415

1516

1617
def not_linux():
@@ -100,11 +101,7 @@ def test_launch_simple(mocker, tmp_path, scan_dir):
100101
testcase.touch()
101102

102103
# Mock TestCase.load to verify correct behavior
103-
mock_testcase = MagicMock()
104-
mock_load = mocker.patch(
105-
"autobisect.evaluators.browser.browser.TestCase.load",
106-
return_value=mock_testcase,
107-
)
104+
testcase_spy = mocker.spy(TestCase, "load")
108105

109106
evaluator = BrowserEvaluator(testcase, scan_dir=scan_dir)
110107

@@ -114,12 +111,8 @@ def test_launch_simple(mocker, tmp_path, scan_dir):
114111
)
115112

116113
# Verify TestCase.load behavior based on scan_dir
117-
if scan_dir:
118-
# When scan_dir=True, load is called with testcase.parent (test_dir in this case)
119-
mock_load.assert_called_with(test_dir, catalog=True)
120-
assert mock_testcase.entry_point == str(testcase)
121-
else:
122-
mock_load.assert_called_with(testcase, catalog=False)
114+
testcase_spy.assert_called_once_with(test_dir, testcase, catalog=scan_dir)
115+
assert testcase_spy.spy_return.entry_point == str(testcase.name)
123116

124117
assert (
125118
evaluator.launch(binary, testcase, scan_dir=scan_dir)

0 commit comments

Comments
 (0)