@@ -3321,12 +3321,14 @@ msgid ""
33213321" to :func:`tearDownModule` then you can call :func:`doModuleCleanups` "
33223322"yourself."
33233323msgstr ""
3324+ "它将负责调用由 :func:`addCleanupModule` 添加的所有清理函数。 如果你需要在 :func:`tearDownModule` "
3325+ "*之前* 调用清理函数则可以自行调用 :func:`doModuleCleanups`。"
33243326
33253327#: ../../library/unittest.rst:2423
33263328msgid ""
33273329":func:`doModuleCleanups` pops methods off the stack of cleanup functions one"
33283330" at a time, so it can be called at any time."
3329- msgstr ""
3331+ msgstr ":func:`doModuleCleanups` 每次会弹出清理函数栈中的一个方法,因此它可以在任何时候被调用。 "
33303332
33313333#: ../../library/unittest.rst:2429
33323334msgid "Signal Handling"
@@ -3341,6 +3343,10 @@ msgid ""
33413343"complete, and the test run will then end and report all the results so far. "
33423344"A second control-c will raise a :exc:`KeyboardInterrupt` in the usual way."
33433345msgstr ""
3346+ "unittest 的 :option:`-c/--catch <unittest -c>` 命令行选项,加上 "
3347+ ":func:`unittest.main()` 的 ``catchbreak`` 形参,提供了在测试运行期间处理 control-C 的更友好方式。 "
3348+ "在捕获中断行为被启用时 control-C 将允许当前运行的测试能够完成,而测试运行将随后结束并报告已有的全部结果。 第二个 control-C "
3349+ "将会正常地引发 :exc:`KeyboardInterrupt`。"
33443350
33453351#: ../../library/unittest.rst:2440
33463352msgid ""
@@ -3353,12 +3359,16 @@ msgid ""
33533359" and delegates to it. For individual tests that need ``unittest`` control-c "
33543360"handling disabled the :func:`removeHandler` decorator can be used."
33553361msgstr ""
3362+ "处理 control-C 信号的句柄会尝试与安装了自定义 :const:`signal.SIGINT` 处理句柄的测试代码保持兼容。 如果是 "
3363+ "``unittest`` 处理句柄而 *不是* 已安装的 :const:`signal.SIGINT` "
3364+ "处理句柄被调用,即它被系统在测试的下层替换并委托处理,则它会调用默认的处理句柄。 这通常会是替换了已安装处理句柄并委托处理的代码所预期的行为。 "
3365+ "对于需要禁用 ``unittest`` control-C 处理的单个测试则可以使用 :func:`removeHandler` 装饰器。"
33563366
33573367#: ../../library/unittest.rst:2449
33583368msgid ""
33593369"There are a few utility functions for framework authors to enable control-c "
33603370"handling functionality within test frameworks."
3361- msgstr ""
3371+ msgstr "还有一些工具函数让框架开发者可以在测试框架内部启用 control-C 处理功能。 "
33623372
33633373#: ../../library/unittest.rst:2454
33643374msgid ""
0 commit comments