Skip to content

Commit a6abec3

Browse files
author
=
committed
Test pytest
1 parent 265c145 commit a6abec3

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
29-
python -m pip install flake8 pytest
29+
python -m pip install flake8 pytest pytest-asyncio
3030
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3131
- name: Lint with flake8
3232
run: |

ThreadPoolExecutorPlus/thread.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,25 @@ def run(self):
165165
_base.LOGGER.critical('Exception in worker', exc_info=True)
166166

167167

168+
168169
class _CustomWeakSet(weakref.WeakSet):
169170

170171
def __repr__(self):
171172
return repr(self.data)
172173

173174

174-
class BrokenThreadPool(_base.BrokenExecutor):
175+
class BrokenExecutor(RuntimeError):
176+
"""
177+
Raised when a executor has become non-functional after a severe failure.
178+
"""
179+
180+
# Upward Compatible
181+
_class_brokenexecutor = BrokenExecutor
182+
if 'BrokenExecutor' in dir(_base):
183+
_class_brokenexecutor = _base.BrokenExecutor
184+
185+
186+
class BrokenThreadPool(_class_brokenexecutor):
175187
"""
176188
Raised when a worker thread in a ThreadPoolExecutor failed initializing.
177189
"""
@@ -308,4 +320,4 @@ def shutdown(self, wait=True):
308320
if wait:
309321
for t in self._threads:
310322
t.join()
311-
shutdown.__doc__ = _base.Executor.shutdown.__doc__
323+
shutdown.__doc__ = _base.Executor.shutdown.__doc__

tests/test_immport.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import os , sys
2-
o_path = os.getcwd()
3-
sys.path.append(os.path.split(o_path)[0])
2+
sys.path.append(os.getcwd())
43
import pytest
54
from ThreadPoolExecutorPlus import *
65

6+
@pytest.mark.asyncio
77
async def test_import():
8+
ThreadPoolExecutor()
89
...

0 commit comments

Comments
 (0)