Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/taskgraph/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ class GraphConfig:

_PATH_MODIFIED = False

def __post_init__(self):
# ensure we have an absolute path; this is required for assumptions
# made later, such as the `vcs_root` being a directory above `root_dir`
object.__setattr__(self, "root_dir", os.path.abspath(self.root_dir))

def __getitem__(self, name):
return self._config[name]

Expand Down
4 changes: 4 additions & 0 deletions test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import os.path

import pytest

from taskgraph.config import GraphConfig
Expand All @@ -10,6 +12,8 @@
def test_graph_config_basic():
graph_config = GraphConfig({"foo": "bar"}, "root")

assert os.path.isabs(graph_config.root_dir)

assert "foo" in graph_config
assert graph_config["foo"] == "bar"
assert graph_config.get("foo") == "bar"
Expand Down
Loading