Skip to content

Commit b953db9

Browse files
committed
fix non editable dash install typing tests
1 parent c14c9da commit b953db9

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

tests/compliance/test_typing.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,26 @@ def run_module(codefile: str, module: str, extra: str = ""):
6969

7070
# For editable installs, we need to find the actual source location
7171
# The test component is installed as an editable package
72-
# Add the project root first so dash itself can be found (editable install)
73-
# Pyright doesn't follow Python's .pth editable install mechanism, so we need
74-
# to point it directly to the source
7572
project_root = os.path.dirname(
7673
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
7774
)
78-
extra_paths = [project_root]
7975

8076
# Get the site-packages directory for standard packages
81-
# Add it after project root so editable installs take precedence
8277
site_packages = sysconfig.get_path("purelib")
83-
extra_paths.append(site_packages)
78+
79+
# Check if dash is installed as editable or regular install
80+
# If editable, we need project root first; if regular, site-packages first
81+
import dash
82+
83+
dash_file = dash.__file__
84+
is_editable = project_root in dash_file
85+
86+
if is_editable:
87+
# Editable install: prioritize project root
88+
extra_paths = [project_root, site_packages]
89+
else:
90+
# Regular install (CI): prioritize site-packages
91+
extra_paths = [site_packages, project_root]
8492

8593
# Add the test component source directories
8694
# They are in the @plotly subdirectory of the project root

0 commit comments

Comments
 (0)