Skip to content

Commit 5d9a528

Browse files
fix: removed exception for vcs root property t
Removing this exception should all for non-standard root directories to work. Closes #522. I am not sure exactly what this #522 is asking for, please correct me if interpretation was wrong
1 parent d2dee6a commit 5d9a528

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/taskgraph/config.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
from voluptuous import ALLOW_EXTRA, All, Any, Extra, Length, Optional, Required
1313

14-
from .util import path
1514
from .util.caches import CACHES
1615
from .util.python_path import find_object
1716
from .util.schema import Schema, optionally_keyed_by, validate_schema
@@ -151,10 +150,6 @@ def register(self):
151150

152151
@property
153152
def vcs_root(self):
154-
if path.split(self.root_dir)[-1:] != ["taskcluster"]:
155-
raise Exception(
156-
"Not guessing path to vcs root. Graph config in non-standard location."
157-
)
158153
return os.path.dirname(self.root_dir)
159154

160155
@property

src/taskgraph/parameters.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,7 @@ def load_parameters_file(
363363

364364
def parameters_loader(spec, strict=True, overrides=None):
365365
def get_parameters(graph_config):
366-
try:
367-
repo_root = graph_config.vcs_root
368-
except Exception:
369-
repo_root = None
366+
repo_root = graph_config.vcs_root
370367

371368
parameters = load_parameters_file(
372369
spec,

test/test_config.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,15 @@ def test_graph_config_basic():
3030

3131
with pytest.raises(TypeError):
3232
graph_config["baz"] = 2
33+
34+
35+
def test_vcs_root_property():
36+
"""Test the vcs_root property returns the parent directory of root_dir without throwing an exception."""
37+
38+
# Test with a standard taskcluster directory structure
39+
graph_config = GraphConfig({}, "/path/to/project/taskcluster")
40+
assert graph_config.vcs_root == "/path/to/project"
41+
42+
# Test with a different directory structure
43+
graph_config = GraphConfig({}, "/path/to/custom/.taskgraph")
44+
assert graph_config.vcs_root == "/path/to/custom"

0 commit comments

Comments
 (0)