import random

import hurdles


class BenchRandom(hurdles.BenchCase):
    def bench_this(self):
        return [random.randint(1, 100000) for x in [0] * 100000]

    def bench_that(self):
        return [random.randint(1, 10000) for y in [0] * 10000]

if __name__ == "__main__":
    B = BenchRandom()
    B.run()

import random

import hurdles

from hurdles.tools import extra_setup


class BenchRandom(hurdles.BenchCase):
    @extra_setup("""import random""")
    def bench_this(self, *args, **kwargs):
        return [random.randint(1, 100000) for x in [0] * 100000]

    def bench_that(self, *args, **kwargs):
        return [random.randint(1, 10000) for y in [0] * 10000]

if __name__ == "__main__":
    B = BenchRandom()
    B.run()

Update : don't forget *args, **kwargs in bench_case methods
Update : don't forget *args, **kwargs in bench_case methods

  import random
  
  import hurdles
  
+ from hurdles.tools import extra_setup
+ 
  
  class BenchRandom(hurdles.BenchCase):
-     def bench_this(self):
+     @extra_setup("""import random""")
+     def bench_this(self, *args, **kwargs):
          return [random.randint(1, 100000) for x in [0] * 100000]
  
-     def bench_that(self):
+     def bench_that(self, *args, **kwargs):
          return [random.randint(1, 10000) for y in [0] * 10000]
  
  if __name__ == "__main__":
      B = BenchRandom()
      B.run()
  
Update : don't forget *args, **kwargs in bench_case methods
## Code Before:
import random

import hurdles


class BenchRandom(hurdles.BenchCase):
    def bench_this(self):
        return [random.randint(1, 100000) for x in [0] * 100000]

    def bench_that(self):
        return [random.randint(1, 10000) for y in [0] * 10000]

if __name__ == "__main__":
    B = BenchRandom()
    B.run()

## Instruction:
Update : don't forget *args, **kwargs in bench_case methods
## Code After:
import random

import hurdles

from hurdles.tools import extra_setup


class BenchRandom(hurdles.BenchCase):
    @extra_setup("""import random""")
    def bench_this(self, *args, **kwargs):
        return [random.randint(1, 100000) for x in [0] * 100000]

    def bench_that(self, *args, **kwargs):
        return [random.randint(1, 10000) for y in [0] * 10000]

if __name__ == "__main__":
    B = BenchRandom()
    B.run()
