Skip to content

Commit

Permalink
Add examples with unittest.TestCase.
Browse files Browse the repository at this point in the history
  • Loading branch information
ionelmc committed Feb 6, 2015
1 parent 6656e7f commit d8035c3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_with_testcase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import time
import unittest

import pytest


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):
with self.benchmark_weave('time.sleep'):
time.sleep(0.0000001)

0 comments on commit d8035c3

Please sign in to comment.