This repository has been archived by the owner on Aug 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue initializing matplotlib and error when thread is not found. #…
- Loading branch information
1 parent
40cbf49
commit 92218e7
Showing
7 changed files
with
88 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/ptvsd/_vendored/pydevd/tests_python/resources/_debugger_case_matplotlib.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from concurrent.futures import ThreadPoolExecutor | ||
import matplotlib | ||
import matplotlib.pyplot as plt | ||
|
||
processed = [] | ||
|
||
|
||
def double(nmbr): | ||
doubled = nmbr * 2 # break here | ||
processed.append(1) | ||
return doubled | ||
|
||
|
||
with ThreadPoolExecutor(max_workers=2) as pool: | ||
futures = [] | ||
|
||
for number in range(3): | ||
future = pool.submit(double, number) | ||
futures.append(future) | ||
|
||
pool.shutdown() | ||
assert len(processed) == 3 | ||
print('TEST SUCEEDED!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import threading | ||
from _pydevd_bundle.pydevd_comm import pydevd_find_thread_by_id | ||
|
||
|
||
def test_is_main_thread(): | ||
from _pydevd_bundle.pydevd_utils import is_current_thread_main_thread | ||
assert is_current_thread_main_thread() | ||
|
||
class NonMainThread(threading.Thread): | ||
|
||
def run(self): | ||
self.is_main_thread = is_current_thread_main_thread() | ||
|
||
non_main_thread = NonMainThread() | ||
non_main_thread.start() | ||
non_main_thread.join() | ||
assert not non_main_thread.is_main_thread | ||
|
||
|
||
def test_find_thread(): | ||
from _pydevd_bundle.pydevd_constants import get_current_thread_id | ||
assert pydevd_find_thread_by_id('123') is None | ||
|
||
assert pydevd_find_thread_by_id( | ||
get_current_thread_id(threading.current_thread())) is threading.current_thread() |