jeudi 1 février 2018

pytest decorator to run benchmark

Im trying to write a decorator @performance that will run both functional test and benchmark (using pytest-benchmark ).

i.e.

@performance
def test_single(num):
  assert do_work(num)

  1. should run the test function reporting (pass/fail)
  2. should run function as if it were declared:

    def test_single_performance(benchmark,num):
      benchmark(test_single,num)  
    
    

i tried creating such decorator but failed as benchmark object was not found or some other parameter error

Aucun commentaire:

Enregistrer un commentaire