File: test_example_pass_in_thread.py

package info (click to toggle)
pytest-check 2.7.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 480 kB
  • sloc: python: 2,220; sh: 17; makefile: 6
file content (21 lines) | stat: -rw-r--r-- 386 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from concurrent.futures.thread import ThreadPoolExecutor
from threading import Thread


from pytest_check import check


def always_pass():
    check.equal(1 + 1, 2)


def test_threadpool():
    with ThreadPoolExecutor() as executor:
        task = executor.submit(always_pass)
        task.result()


def test_threading():
    t = Thread(target=always_pass)
    t.start()
    t.join()