You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# A low-level test execution failure occurred before tests were run.
raiseTaskError()
...and then consuming it from a new @console_rule (similar to fast_list) that will look roughly like:
@console_rule('test', [Select(Console), Select(HydratedTargets)])
def fast_test(console, hydrated_targets):
test_results = yield [Get(TestResult, HydratedTarget, ht) for ht in hydrated_targets]
... # use extracted static function to render the `TestResult` instances.
So the meat of the change is 1) extracting the static function to use it from an @console_rule, 2) adding a coverage test for the @console_rule (described below).
A coverage test of these @rules will look like:
extending TestBase
registering the new rules using a def rules(cls): definition on your TestBase instance (similar to this one) in the python backend's register.py
additionally registering some basic/dummy "TestResults" @rules in def rules that will provide the TestResult inputs that the @console_rule will need.
calling
# Request the `test` goal for any dummy target (perhaps just a `target(..)` alias).
specs = Specs((SingleAddress('testprojects/my/dummy/project'),))
# Request execution of the synthetic `test` product using GoalProduct from src/python/pants/engine/rules.py
test_result, = self.scheduler.product_request(_GoalProduct.for_name('test'), specs)
...in the test, which should cause your registered @console_rule to execute*. The test should just confirm that the rule execution does not fail.
* NB: this will not actually allow for testing the rendered output of the @console_rule, but it will not be possible to do that until #6571 is completed.
The text was updated successfully, but these errors were encountered:
breakout task from the v2 FE HLD here
This issue covers adding a
@console_rule
(and possibly some support@rule
s) that implements basic rendering of test result values.This should look like extracting the TestResult rendering logic from
TestrunnerTaskMixin
into a static function:pants/src/python/pants/task/testrunner_task_mixin.py
Lines 461 to 485 in 568a581
...and then consuming it from a new
@console_rule
(similar to fast_list) that will look roughly like:So the meat of the change is 1) extracting the static function to use it from an
@console_rule
, 2) adding a coverage test for the@console_rule
(described below).A coverage test of these
@rule
s will look like:TestBase
def rules(cls):
definition on yourTestBase
instance (similar to this one) in the python backend's register.py@rules
indef rules
that will provide theTestResult
inputs that the@console_rule
will need....in the test, which should cause your registered
@console_rule
to execute*. The test should just confirm that the rule execution does not fail.* NB: this will not actually allow for testing the rendered output of the
@console_rule
, but it will not be possible to do that until #6571 is completed.The text was updated successfully, but these errors were encountered: