Pysys - How to run only the verifiable portion of a test

I am considering a way to add a new "mode" to Pysys Baserunner.

In particular, I would like to add a validation mode that simply restarts the validation part. Useful when you are writing your test file and trying to tweak the validation condition to match the current result, without re-running the entire test system.

What is the best way to do this without changing the original class?

+3


source to share


1 answer


This requires out-of-box support. The problem is that the BaseRunner class will always clean up the output directory automatically and there is no hook in the framework for you to avoid that. You can, for example, move the original subdirectory manually that you want to rerun the scan to say "redo" (same directory level) and then use;

from pysys.constants import *
from pysys.basetest import BaseTest

class PySysTest(BaseTest):
    def execute(self):
        if self.mode=='repeat': pass

    def validate(self):
        if self.mode=='repeat':
            self.output=os.path.join(self.descriptor.output, 'repeat')

      

where I have omitted the runtime implementations and check. You will need to add the mode to the descriptor for the test



  <classification>
    <groups>
      <group></group>
    </groups>
    <modes>
      <mode>repeat</mode>
    </modes>
  </classification>

      

and run with "pysys.py run -mrepeat". This will help with debugging if your run takes a long time, but probably doesn't want you to want an out-of-the-box, that is, a top-level runner option to just check for a previous test. I'll add a feature request for this.

+1


source







All Articles