File tree Expand file tree Collapse file tree 2 files changed +51
-2
lines changed
Expand file tree Collapse file tree 2 files changed +51
-2
lines changed Original file line number Diff line number Diff line change 44# LICENSE file in the root directory of this source tree.
55
66import logging
7+ from pathlib import Path
78
89from ... import commands , configuration as configuration_module
9- from . import remote_logging
10+ from . import remote_logging , statistics
1011
1112LOG : logging .Logger = logging .getLogger (__name__ )
1213
1314
15+ def find_root (
16+ configuration : configuration_module .Configuration , working_directory : Path
17+ ) -> Path :
18+ local_root = configuration .local_root
19+ if local_root is not None :
20+ return Path (local_root )
21+
22+ return working_directory
23+
24+
1425def run_coverage (
1526 configuration : configuration_module .Configuration , working_directory : str
1627) -> commands .ExitCode :
17- LOG .warning ("Coming soon..." )
28+ sources = statistics .find_paths_to_parse (
29+ [find_root (configuration , Path (working_directory ))]
30+ )
31+ LOG .warning (f"SOURCES = { list (sources )} " )
1832 return commands .ExitCode .SUCCESS
1933
2034
Original file line number Diff line number Diff line change 1+ # Copyright (c) Facebook, Inc. and its affiliates.
2+ #
3+ # This source code is licensed under the MIT license found in the
4+ # LICENSE file in the root directory of this source tree.
5+
6+ from pathlib import Path
7+
8+ import testslide
9+
10+ from .... import configuration
11+ from ..coverage import find_root
12+
13+
14+ class CoverageTest (testslide .TestCase ):
15+ def test_find_root (self ) -> None :
16+ self .assertEqual (
17+ find_root (
18+ configuration .Configuration (
19+ project_root = "/root" ,
20+ dot_pyre_directory = Path ("/irrelevant" ),
21+ relative_local_root = "local" ,
22+ ),
23+ working_directory = Path ("/irrelevant" ),
24+ ),
25+ Path ("/root/local" ),
26+ )
27+ self .assertEqual (
28+ find_root (
29+ configuration .Configuration (
30+ project_root = "/root" , dot_pyre_directory = Path ("/irrelevant" )
31+ ),
32+ working_directory = Path ("/working/dir" ),
33+ ),
34+ Path ("/working/dir" ),
35+ )
You can’t perform that action at this time.
0 commit comments