Skip to content

Commit cecf857

Browse files
committed
fix tests
1 parent 77e7053 commit cecf857

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

codeflash/discovery/functions_to_optimize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def find_all_functions_in_file(file_path: Path) -> dict[Path, list[FunctionToOpt
268268
def get_all_replay_test_functions(
269269
replay_test: Path, test_cfg: TestConfig, project_root_path: Path
270270
) -> dict[Path, list[FunctionToOptimize]]:
271-
function_tests = discover_unit_tests(test_cfg, discover_only_these_tests=[replay_test])
271+
function_tests, _ = discover_unit_tests(test_cfg, discover_only_these_tests=[replay_test])
272272
# Get the absolute file paths for each function, excluding class name if present
273273
filtered_valid_functions = defaultdict(list)
274274
file_to_functions_map = defaultdict(list)

codeflash/verification/concolic_testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def generate_concolic_tests(
7878
test_framework=args.test_framework,
7979
pytest_cmd=args.pytest_cmd,
8080
)
81-
function_to_concolic_tests = discover_unit_tests(concolic_test_cfg)
81+
function_to_concolic_tests, _ = discover_unit_tests(concolic_test_cfg)
8282
num_discovered_concolic_tests: int = sum([len(value) for value in function_to_concolic_tests.values()])
8383
logger.info(
8484
f"Created {num_discovered_concolic_tests} "

tests/test_unit_test_discovery.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_unit_test_discovery_pytest():
1515
test_framework="pytest",
1616
tests_project_rootdir=tests_path.parent,
1717
)
18-
tests = discover_unit_tests(test_config)
18+
tests, _ = discover_unit_tests(test_config)
1919
assert len(tests) > 0
2020

2121

@@ -28,7 +28,7 @@ def test_benchmark_test_discovery_pytest():
2828
test_framework="pytest",
2929
tests_project_rootdir=tests_path.parent,
3030
)
31-
tests = discover_unit_tests(test_config)
31+
tests, _ = discover_unit_tests(test_config)
3232
assert len(tests) == 1 # Should not discover benchmark tests
3333

3434

@@ -42,7 +42,7 @@ def test_unit_test_discovery_unittest():
4242
tests_project_rootdir=project_path.parent,
4343
)
4444
os.chdir(project_path)
45-
tests = discover_unit_tests(test_config)
45+
tests, _ = discover_unit_tests(test_config)
4646
# assert len(tests) > 0
4747
# Unittest discovery within a pytest environment does not work
4848

@@ -80,7 +80,7 @@ def sorter(arr):
8080
)
8181

8282
# Discover tests
83-
tests = discover_unit_tests(test_config)
83+
tests, _ = discover_unit_tests(test_config)
8484
assert len(tests) == 1
8585
assert 'bubble_sort.sorter' in tests
8686
assert len(tests['bubble_sort.sorter']) == 2
@@ -119,7 +119,7 @@ def test_discover_tests_pytest_with_temp_dir_root():
119119
)
120120

121121
# Discover tests
122-
discovered_tests = discover_unit_tests(test_config)
122+
discovered_tests, _ = discover_unit_tests(test_config)
123123

124124
# Check if the dummy test file is discovered
125125
assert len(discovered_tests) == 1
@@ -192,7 +192,7 @@ def test_discover_tests_pytest_with_multi_level_dirs():
192192
)
193193

194194
# Discover tests
195-
discovered_tests = discover_unit_tests(test_config)
195+
discovered_tests, _ = discover_unit_tests(test_config)
196196

197197
# Check if the test files at all levels are discovered
198198
assert len(discovered_tests) == 3
@@ -282,7 +282,7 @@ def test_discover_tests_pytest_dirs():
282282
)
283283

284284
# Discover tests
285-
discovered_tests = discover_unit_tests(test_config)
285+
discovered_tests, _ = discover_unit_tests(test_config)
286286

287287
# Check if the test files at all levels are discovered
288288
assert len(discovered_tests) == 4
@@ -328,7 +328,7 @@ def test_discover_tests_pytest_with_class():
328328
)
329329

330330
# Discover tests
331-
discovered_tests = discover_unit_tests(test_config)
331+
discovered_tests, _ = discover_unit_tests(test_config)
332332

333333
# Check if the test class and method are discovered
334334
assert len(discovered_tests) == 1
@@ -366,7 +366,7 @@ def test_discover_tests_pytest_with_double_nested_directories():
366366
)
367367

368368
# Discover tests
369-
discovered_tests = discover_unit_tests(test_config)
369+
discovered_tests, _ = discover_unit_tests(test_config)
370370

371371
# Check if the test class and method are discovered
372372
assert len(discovered_tests) == 1
@@ -416,7 +416,7 @@ def test_discover_tests_with_code_in_dir_and_test_in_subdir():
416416
)
417417

418418
# Discover tests
419-
discovered_tests = discover_unit_tests(test_config)
419+
discovered_tests, _ = discover_unit_tests(test_config)
420420

421421
# Check if the test file is discovered and associated with the code file
422422
assert len(discovered_tests) == 1
@@ -455,7 +455,7 @@ def test_discover_tests_pytest_with_nested_class():
455455
)
456456

457457
# Discover tests
458-
discovered_tests = discover_unit_tests(test_config)
458+
discovered_tests, _ = discover_unit_tests(test_config)
459459

460460
# Check if the test for the nested class method is discovered
461461
assert len(discovered_tests) == 1
@@ -495,7 +495,7 @@ def test_discover_tests_pytest_separate_moduledir():
495495
)
496496

497497
# Discover tests
498-
discovered_tests = discover_unit_tests(test_config)
498+
discovered_tests, _ = discover_unit_tests(test_config)
499499

500500
# Check if the test for the nested class method is discovered
501501
assert len(discovered_tests) == 1
@@ -537,7 +537,7 @@ def test_add(self):
537537
)
538538

539539
# Discover tests
540-
discovered_tests = discover_unit_tests(test_config)
540+
discovered_tests, _ = discover_unit_tests(test_config)
541541

542542
# Verify the unittest was discovered
543543
assert len(discovered_tests) == 1
@@ -604,7 +604,7 @@ def test_add(self):
604604
)
605605

606606
# Discover tests
607-
discovered_tests = discover_unit_tests(test_config)
607+
discovered_tests, _ = discover_unit_tests(test_config)
608608

609609
# Verify the unittest was discovered
610610
assert len(discovered_tests) == 2
@@ -649,7 +649,7 @@ def _test_add(self): # Private test method should not be discovered
649649
)
650650

651651
# Discover tests
652-
discovered_tests = discover_unit_tests(test_config)
652+
discovered_tests, _ = discover_unit_tests(test_config)
653653

654654
# Verify no tests were discovered
655655
assert len(discovered_tests) == 0
@@ -701,7 +701,7 @@ def test_add_with_parameters(self):
701701
)
702702

703703
# Discover tests
704-
discovered_tests = discover_unit_tests(test_config)
704+
discovered_tests, _ = discover_unit_tests(test_config)
705705

706706
# Verify the unittest was discovered
707707
assert len(discovered_tests) == 1
@@ -783,7 +783,7 @@ def test_add_mixed(self, name, a, b, expected):
783783
)
784784

785785
# Discover tests
786-
discovered_tests = discover_unit_tests(test_config)
786+
discovered_tests, _ = discover_unit_tests(test_config)
787787

788788
# Verify the basic structure
789789
assert len(discovered_tests) == 2 # Should have tests for both add and multiply

0 commit comments

Comments
 (0)