Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test load thrift file in sub-thread #269

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading