Skip to content

Commit 2700650

Browse files
committed
symlink issues, resolved
1 parent fedc5c1 commit 2700650

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/test_code_context_extractor.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,9 +1800,10 @@ def get_system_details():
18001800

18011801
# Set up the optimizer
18021802
file_path = main_file_path.resolve()
1803+
project_root = package_dir.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",
@@ -1826,8 +1827,10 @@ def get_system_details():
18261827
read_write_context, read_only_context = code_ctx.read_writable_code, code_ctx.read_only_context_code
18271828
hashing_context = code_ctx.hashing_code_context
18281829
# The expected contexts
1830+
# Resolve both paths to handle symlink issues on macOS
1831+
relative_path = file_path.relative_to(project_root)
18291832
expected_read_write_context = f"""
1830-
```python:{main_file_path.relative_to(opt.args.project_root)}
1833+
```python:{relative_path}
18311834
import utility_module
18321835
18331836
class Calculator:
@@ -2045,9 +2048,10 @@ def get_system_details():
20452048

20462049
# Set up the optimizer
20472050
file_path = main_file_path.resolve()
2051+
project_root = package_dir.resolve()
20482052
opt = Optimizer(
20492053
Namespace(
2050-
project_root=package_dir.resolve(),
2054+
project_root=project_root,
20512055
disable_telemetry=True,
20522056
tests_root="tests",
20532057
test_framework="pytest",
@@ -2070,6 +2074,7 @@ def get_system_details():
20702074
code_ctx = get_code_optimization_context(function_to_optimize, opt.args.project_root)
20712075
read_write_context, read_only_context = code_ctx.read_writable_code, code_ctx.read_only_context_code
20722076
# The expected contexts
2077+
relative_path = file_path.relative_to(project_root)
20732078
expected_read_write_context = f"""
20742079
```python:utility_module.py
20752080
# Function that will be used in the main code
@@ -2096,7 +2101,7 @@ def select_precision(precision, fallback_precision):
20962101
else:
20972102
return DEFAULT_PRECISION
20982103
```
2099-
```python:{main_file_path.relative_to(opt.args.project_root)}
2104+
```python:{relative_path}
21002105
import utility_module
21012106
21022107
class Calculator:

0 commit comments

Comments
 (0)