-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
243 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 0.6.0 | ||
current_version = 0.7.0 | ||
commit = False | ||
tag = False | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
""" | ||
Store build information. | ||
""" | ||
from dataclasses import dataclass | ||
from typing import Optional | ||
|
||
from microcosm.api import defaults, typed | ||
|
||
|
||
@dataclass | ||
class BuildInfo: | ||
build_num: Optional[str] | ||
sha1: Optional[str] | ||
|
||
|
||
@defaults( | ||
build_num=typed(str, default_value=None), | ||
sha1=typed(str, default_value=None), | ||
) | ||
def configure_build_info(graph): | ||
""" | ||
Configure build info | ||
""" | ||
return BuildInfo( | ||
build_num=graph.config.build_info.build_num, | ||
sha1=graph.config.build_info.sha1, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Unit tests for build_info | ||
""" | ||
from hamcrest import assert_that, is_ | ||
from microcosm.api import create_object_graph, load_from_dict | ||
|
||
|
||
class TestBuildInfo: | ||
|
||
def test_cached(self): | ||
graph = create_object_graph( | ||
"test", | ||
testing=True, | ||
loader=load_from_dict(dict( | ||
build_info=dict(sha1="asdf1234", build_num="5"), | ||
)), | ||
) | ||
graph.use( | ||
"build_info", | ||
) | ||
|
||
assert_that(graph.build_info.sha1, is_("asdf1234")) |
Oops, something went wrong.