Skip to content

Commit 9b4a7a0

Browse files
generatedunixname647790274085263facebook-github-bot
generatedunixname647790274085263
authored andcommitted
Fix silently skipped async tests (idb)
Summary: When using `unittest.TestCase`, any coroutines that look like test cases won't be awaited properly, causing the test to pass immediately. This diff fixes these test cases by switching to `unittest.IsolatedAsyncioTestCase` which will start properly running these tests. I fully expect red signal on this diff, but will still land it, because a failing test is better than a silently skipped one. This diff was produced by: ``` sl go D57273213 cd fbcode arc lint --take FIXIT --paths-cmd 'hg files -I "**/*.py" | grep test' -a HG: manually revert unrelated fixit changes sl st | awk '{print $2}' | xargs pylot run fbcode//python/libcst/ codemod ensure_import_present.EnsureImportPresentCommand --module unittest --entity IsolatedAsyncioTestCase sl st | awk '{print $2}' | xargs pylot run fbcode//python/libcst/ codemod remove_unused_imports.RemoveUnusedImportsWithGlean HG: manually add back these unused imports unrelated to this change: P1370679492 HG: split the diff per oncall ./scripts/zsol/split.sh ``` Reviewed By: Nekitosss Differential Revision: D57771323 fbshipit-source-id: efb6632235e6be396fdddace969e9c480f7aea53
1 parent 45666c7 commit 9b4a7a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

idb/grpc/tests/xctest_tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
import os.path
1010
import plistlib
1111
import tempfile
12-
from unittest import TestCase
12+
from unittest import IsolatedAsyncioTestCase
1313

1414
from idb.grpc.xctest import extract_paths_from_xctestrun
1515

1616

17-
class XCTestsTestCase(TestCase):
17+
class XCTestsTestCase(IsolatedAsyncioTestCase):
1818
async def test_extract_paths_from_xctestrun(self) -> None:
1919
with tempfile.TemporaryDirectory() as tmp_dir:
2020
file_path = os.path.join(tmp_dir, "test.plist")

0 commit comments

Comments
 (0)