File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
src/databricks/labs/ucx/source_code
tests/integration/source_code Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -477,22 +477,22 @@ def __repr__(self):
477477 return f"<DependencyResolver { self ._notebook_resolver } { self ._import_resolver } { self ._file_resolver } , { self ._path_lookup } >"
478478
479479
480- MISSING_SOURCE_PATH = "<MISSING_SOURCE_PATH>"
480+ _MISSING_SOURCE_PATH = Path ( "<MISSING_SOURCE_PATH>" )
481481
482482
483483@dataclass
484484class DependencyProblem :
485485 code : str
486486 message : str
487- source_path : Path = Path ( MISSING_SOURCE_PATH )
487+ source_path : Path = _MISSING_SOURCE_PATH
488488 # Lines and columns are both 0-based: the first line is line 0.
489489 start_line : int = - 1
490490 start_col : int = - 1
491491 end_line : int = - 1
492492 end_col : int = - 1
493493
494494 def is_path_missing (self ) -> bool :
495- return self .source_path == Path ( MISSING_SOURCE_PATH )
495+ return self .source_path == _MISSING_SOURCE_PATH
496496
497497 def as_advisory (self ) -> 'Advisory' :
498498 return Advisory (
Original file line number Diff line number Diff line change 1+ import dataclasses
12from pathlib import Path
23
34
45from databricks .labs .ucx .source_code .base import CurrentSessionState
5- from databricks .labs .ucx .source_code .graph import DependencyResolver , DependencyGraph
6+ from databricks .labs .ucx .source_code .graph import DependencyResolver , DependencyGraph , DependencyProblem
67from databricks .labs .ucx .source_code .known import KnownList , Compatibility , UNKNOWN
78from databricks .labs .ucx .source_code .linters .files import FileLoader , ImportFileResolver
89from databricks .labs .ucx .source_code .notebooks .loaders import NotebookLoader , NotebookResolver
@@ -57,3 +58,10 @@ def test_graph_imports_dynamic_import():
5758 container = maybe .dependency .load (path_lookup )
5859 problems = container .build_dependency_graph (graph )
5960 assert not problems
61+
62+
63+ def test_is_path_missing ():
64+ problem = DependencyProblem ("some-code" , "some-message" )
65+ assert problem .is_path_missing ()
66+ problem = dataclasses .replace (problem , source_path = Path ("stuff" ))
67+ assert not problem .is_path_missing ()
You can’t perform that action at this time.
0 commit comments