Skip to content

Commit

Permalink
Test load thrift file in sub-thread (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
aisk authored May 17, 2024
1 parent 261f90c commit 30deec7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@

dev_requires = [
"flake8>=2.5",
"pytest>=2.8",
"sphinx-rtd-theme>=0.1.9",
"sphinx>=1.3",
"pytest-reraise",
"pytest>=6.1.1",
] + tornado_requires

Expand Down
12 changes: 12 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

import threading

import pytest
from thriftpy2.thrift import TType
from thriftpy2.parser import load, load_fp
Expand Down Expand Up @@ -41,6 +43,16 @@ def test_cpp_include():
load('parser-cases/cpp_include.thrift')


def test_load_in_sub_thread(reraise):
@reraise.wrap
def f():
load('addressbook.thrift')

t = threading.Thread(target=f)
t.start()
t.join()


def test_tutorial():
thrift = load('parser-cases/tutorial.thrift', include_dirs=[
'./parser-cases'])
Expand Down

0 comments on commit 30deec7

Please sign in to comment.