joealcorn / laboratory

Achieving confident refactoring through experimentation with Python 2.7 & 3.3+

Home Page:https://laboratory-python.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conditionally run candidates

joealcorn opened this issue · comments

Maybe we don't want to run the candidates on every invocation. We should have a way to skip candidate execution.

Similar to the way scientist has implemented this, I'm thinking something like this for the API, which would enable it 10% of the time

class Experiment(laboratory.Experiment):
    def enabled(self):
        return random.choice(range(1, 100)) > 90