Answer stability round 1: 0 🔴, 7 🟡 (0 misread); parse the formula on load, require the scoring, share the bar rule and split add
This commit is contained in:
@@ -9,7 +9,7 @@ import unittest.mock
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from project_config.settings import env_files, Epic, Finish, held, load, NOTIFIERS, OUTSIDE, Page, ProjectConfig, Scoring, SETTINGS, Unnamed
|
||||
from project_config.settings import env_files, Epic, Finish, held, JiraScoring, load, NOTIFIERS, OUTSIDE, Page, ProjectConfig, SETTINGS, Unnamed
|
||||
from failure import Failure
|
||||
from test_env import isolated_env
|
||||
from project_config.main import located, title_templates
|
||||
@@ -325,7 +325,7 @@ class LoadTest(ConfigCase):
|
||||
self.write("acme", JIRA_CLIENT.replace("jira-score-bar = 1", "jira-score-bar = 0.5"))
|
||||
named = load(self.checkout, self.checkout, self.home)
|
||||
assert isinstance(named, ProjectConfig), named
|
||||
self.assertEqual(named.jira_scoring, Scoring("100 * V / (2**S + 8)", 0.5))
|
||||
self.assertEqual(named.jira_scoring, JiraScoring("100 * V / (2**S + 8)", 0.5))
|
||||
|
||||
def test_a_plan_in_a_file_holds_no_formula_or_bar_of_the_configs(self) -> None:
|
||||
self.write("acme", CLIENT)
|
||||
@@ -348,6 +348,13 @@ class LoadTest(ConfigCase):
|
||||
config.write_text(CLIENT + JIRA_SCORING)
|
||||
self.assertIn("`jira-score-formula` is set, so `plan` must name a Jira epic; `jira-score-bar` is set, so `plan` must name a Jira epic", self.failure())
|
||||
|
||||
def test_a_formula_that_doesnt_parse_fails_naming_the_setting_and_why(self) -> None:
|
||||
config = self.write("acme", JIRA_CLIENT) / "config.toml"
|
||||
for formula, why in (("V +", "the formula 'V +' does not parse"), ("X", "the formula 'X' may hold only numbers, E, I, L, R, S, V, + - * / ** and parentheses")):
|
||||
with self.subTest(formula=formula):
|
||||
config.write_text(JIRA_CLIENT.replace('"100 * V / (2**S + 8)"', f'"{formula}"'))
|
||||
self.assertIn(f"`jira-score-formula` is '{formula}': {why}", self.failure())
|
||||
|
||||
def test_a_notifier_that_is_unknown_or_has_no_env_file_fails_naming_it(self) -> None:
|
||||
self.write("acme", CLIENT + 'env-file = "~/acme.env"\nnotifier = "teams"\n')
|
||||
self.assertIn("`notifier` is 'teams', not mattermost or slack", self.failure())
|
||||
|
||||
Reference in New Issue
Block a user