Skip to content

Commit 4bb7a7b

Browse files
committed
resolve them here too
1 parent 2c07d6d commit 4bb7a7b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/test_code_context_extractor.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R:
459459
read_write_context, read_only_context = code_ctx.read_writable_code, code_ctx.read_only_context_code
460460
hashing_context = code_ctx.hashing_code_context
461461
expected_read_write_context = f"""
462-
```python:{file_path.relative_to(opt.args.project_root)}
462+
```python:{file_path.resolve().relative_to(opt.args.project_root)}
463463
class AbstractCacheBackend(CacheBackend, Protocol[_KEY_T, _STORE_T]):
464464
465465
def __init__(self) -> None: ...
@@ -557,7 +557,7 @@ def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R:
557557
```
558558
"""
559559
expected_read_only_context = f'''
560-
```python:{file_path.relative_to(opt.args.project_root)}
560+
```python:{file_path.resolve().relative_to(opt.args.project_root)}
561561
_P = ParamSpec("_P")
562562
_KEY_T = TypeVar("_KEY_T")
563563
_STORE_T = TypeVar("_STORE_T")
@@ -1799,10 +1799,11 @@ def get_system_details():
17991799
main_file.flush()
18001800

18011801
# Set up the optimizer
1802+
project_root = package_dir.resolve()
18021803
file_path = main_file_path.resolve()
18031804
opt = Optimizer(
18041805
Namespace(
1805-
project_root=package_dir.resolve(),
1806+
project_root=project_root,
18061807
disable_telemetry=True,
18071808
tests_root="tests",
18081809
test_framework="pytest",
@@ -1827,7 +1828,7 @@ def get_system_details():
18271828
hashing_context = code_ctx.hashing_code_context
18281829
# The expected contexts
18291830
expected_read_write_context = f"""
1830-
```python:{main_file_path.relative_to(opt.args.project_root)}
1831+
```python:{file_path.relative_to(project_root)}
18311832
import utility_module
18321833
18331834
class Calculator:
@@ -2044,10 +2045,11 @@ def get_system_details():
20442045
main_file.flush()
20452046

20462047
# Set up the optimizer
2048+
project_root = package_dir.resolve()
20472049
file_path = main_file_path.resolve()
20482050
opt = Optimizer(
20492051
Namespace(
2050-
project_root=package_dir.resolve(),
2052+
project_root=project_root,
20512053
disable_telemetry=True,
20522054
tests_root="tests",
20532055
test_framework="pytest",
@@ -2096,7 +2098,7 @@ def select_precision(precision, fallback_precision):
20962098
else:
20972099
return DEFAULT_PRECISION
20982100
```
2099-
```python:{main_file_path.relative_to(opt.args.project_root)}
2101+
```python:{file_path.relative_to(project_root)}
21002102
import utility_module
21012103
21022104
class Calculator:

0 commit comments

Comments
 (0)