Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F12944909
D14262.id41460.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D14262.id41460.diff
View Options
diff --git a/electrum/test_runner.py b/electrum/test_runner.py
--- a/electrum/test_runner.py
+++ b/electrum/test_runner.py
@@ -3,7 +3,15 @@
import re
import subprocess
import unittest
-from collections.abc import Iterable
+
+# Whitelist of modules with allowable errors during automated test discovery.
+KNOWN_FAILURES = [
+ # PyQt5 not installed (currently nothing in the gui package is tested)
+ r"electrumabc_gui(\.qt)*",
+ # jsonrpcclient not installed.
+ # Note that regtests are not unittest cases, so they would not be run anyway.
+ r"electrumabc.tests.regtest.*",
+]
# Use realpath in case this script is called via a symbolic link
ELECTRUM_DIR = os.path.dirname(os.path.realpath(__file__))
@@ -31,14 +39,12 @@
ELECTRUM_DIR, pattern="test_*.py"
):
for test_suite in all_test_suite:
- if not isinstance(test_suite, Iterable):
- # unittest sometimes runs into errors when trying to detect test files, and
- # then returns a _FailedTest object that makes addTests fail with
- # `TypeError: '_FailedTest' object is not iterable`
- # This happens for instance with electrumabc_gui when PyQt5 is missing.
- # We don't want PyQt5 to be a hard dependency for tests for now:.
+ if isinstance(test_suite, unittest.loader._FailedTest) and any(
+ re.match(pattern, test_suite._testMethodName)
+ for pattern in KNOWN_FAILURES
+ ):
continue
- suite.addTests(test_suite)
+ suite.addTest(test_suite)
return suite
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 6, 16:08 (16 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5082367
Default Alt Text
D14262.id41460.diff (1 KB)
Attached To
D14262: [electrum] be selective about ignoring errors
Event Timeline
Log In to Comment