File: test_with_testcase.py

package info (click to toggle)
python-pytest-benchmark 5.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,072 kB
  • sloc: python: 5,232; makefile: 12
file content (24 lines) | stat: -rw-r--r-- 620 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import time
import unittest

import pytest

aspectlib = pytest.importorskip("aspectlib")

class TerribleTerribleWayToWriteTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def setupBenchmark(self, benchmark):
        self.benchmark = benchmark

    def test_foo(self):
        self.benchmark(time.sleep, 0.000001)


class TerribleTerribleWayToWritePatchTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def setupBenchmark(self, benchmark_weave):
        self.benchmark_weave = benchmark_weave

    def test_foo2(self):
        self.benchmark_weave('time.sleep')
        time.sleep(0.0000001)