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):
477
477
return f"<DependencyResolver { self ._notebook_resolver } { self ._import_resolver } { self ._file_resolver } , { self ._path_lookup } >"
478
478
479
479
480
- MISSING_SOURCE_PATH = "<MISSING_SOURCE_PATH>"
480
+ _MISSING_SOURCE_PATH = Path ( "<MISSING_SOURCE_PATH>" )
481
481
482
482
483
483
@dataclass
484
484
class DependencyProblem :
485
485
code : str
486
486
message : str
487
- source_path : Path = Path ( MISSING_SOURCE_PATH )
487
+ source_path : Path = _MISSING_SOURCE_PATH
488
488
# Lines and columns are both 0-based: the first line is line 0.
489
489
start_line : int = - 1
490
490
start_col : int = - 1
491
491
end_line : int = - 1
492
492
end_col : int = - 1
493
493
494
494
def is_path_missing (self ) -> bool :
495
- return self .source_path == Path ( MISSING_SOURCE_PATH )
495
+ return self .source_path == _MISSING_SOURCE_PATH
496
496
497
497
def as_advisory (self ) -> 'Advisory' :
498
498
return Advisory (
Original file line number Diff line number Diff line change
1
+ import dataclasses
1
2
from pathlib import Path
2
3
3
4
4
5
from 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
6
7
from databricks .labs .ucx .source_code .known import KnownList , Compatibility , UNKNOWN
7
8
from databricks .labs .ucx .source_code .linters .files import FileLoader , ImportFileResolver
8
9
from databricks .labs .ucx .source_code .notebooks .loaders import NotebookLoader , NotebookResolver
@@ -57,3 +58,10 @@ def test_graph_imports_dynamic_import():
57
58
container = maybe .dependency .load (path_lookup )
58
59
problems = container .build_dependency_graph (graph )
59
60
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