teemtee / tmt

Test Management Tool
MIT License
80 stars 121 forks source link

Remove workdir does not work when finish step not enabled #513

Open psss opened 3 years ago

psss commented 3 years ago

For this quite common use case (check which tests would be run) workdir is not removed:

tmt run -rv discover

User needs to do:

tmt run -rf discover finish

I guess explicitly specifying the finish step should not be necessary.

idorax commented 2 years ago

@psss and @lukaszachy, since we have option PLAN_SKIP_WORKTREE_INIT now while fixing issue 1061, can we use the similar approach to fix this issue?

# Option to skip to initialize work tree in plan
PLAN_SKIP_WORKTREE_INIT = 'plan_skip_worktree_init'
lukaszachy commented 2 years ago

I'm not sure we need such option - Isn't it enough to remove check for finish.enabled at https://github.com/teemtee/tmt/blob/main/tmt/base.py#L1651 ?

I didn't expect that -r (as run option) depends on 'finish' plugin being run. However we can have discussion what is meant by finished in tmt run --help's "Remove the workdir when test run is finished"

lukaszachy commented 2 years ago

I always understood it as 'tmt run process is finished' not 'step called finish was used'

idorax commented 2 years ago

I always understood it as 'tmt run process is finished' not 'step called finish was used'

@lukaszachy, in the command tmt run -rf discover finish pasted by @psss , finish right here is a step?

idorax commented 2 years ago

I didn't expect that -r (as run option) depends on 'finish' plugin being run. However we can have discussion what is meant by finished in tmt run --help's "Remove the workdir when test run is finished"

From the code of tmt/cli.py#L223,

@click.option(
    '-r', '--rm', '--remove', 'remove', is_flag=True,
    help='Remove the workdir when test run is finished.')

(from my understanding), it means if we specify -r in tmt run ..., the workdir should be removd.