|
14 | 14 | import_pytest.unittest |
15 | 15 | import_pytest.logging |
16 | 16 |
|
| 17 | +frompackaging.versionimportVersion |
| 18 | + |
17 | 19 | # ///////////////////////////////////////////////////////////////////////////// |
18 | 20 |
|
19 | 21 | C_ROOT_DIR__RELATIVE=".." |
20 | 22 |
|
| 23 | +# ///////////////////////////////////////////////////////////////////////////// |
| 24 | +# T_PLUGGY_RESULT |
| 25 | + |
| 26 | +ifVersion(pluggy.__version__)<=Version("1.2"): |
| 27 | +T_PLUGGY_RESULT=pluggy._result._Result |
| 28 | +else: |
| 29 | +T_PLUGGY_RESULT=pluggy.Result |
| 30 | + |
21 | 31 | # ///////////////////////////////////////////////////////////////////////////// |
22 | 32 | # TestConfigPropNames |
23 | 33 |
|
@@ -344,15 +354,15 @@ def helper__build_test_id(item: pytest.Function) -> str: |
344 | 354 |
|
345 | 355 |
|
346 | 356 | defhelper__makereport__setup( |
347 | | -item:pytest.Function,call:pytest.CallInfo,outcome:pluggy.Result |
| 357 | +item:pytest.Function,call:pytest.CallInfo,outcome:T_PLUGGY_RESULT |
348 | 358 | ): |
349 | 359 | assertitemisnotNone |
350 | 360 | assertcallisnotNone |
351 | 361 | assertoutcomeisnotNone |
352 | 362 | # it may be pytest.Function or _pytest.unittest.TestCaseFunction |
353 | 363 | assertisinstance(item,pytest.Function) |
354 | 364 | asserttype(call)==pytest.CallInfo# noqa: E721 |
355 | | -asserttype(outcome)==pluggy.Result# noqa: E721 |
| 365 | +asserttype(outcome)==T_PLUGGY_RESULT# noqa: E721 |
356 | 366 |
|
357 | 367 | C_LINE1="******************************************************" |
358 | 368 |
|
@@ -403,15 +413,15 @@ def helper__makereport__setup( |
403 | 413 |
|
404 | 414 | # ------------------------------------------------------------------------ |
405 | 415 | defhelper__makereport__call( |
406 | | -item:pytest.Function,call:pytest.CallInfo,outcome:pluggy.Result |
| 416 | +item:pytest.Function,call:pytest.CallInfo,outcome:T_PLUGGY_RESULT |
407 | 417 | ): |
408 | 418 | assertitemisnotNone |
409 | 419 | assertcallisnotNone |
410 | 420 | assertoutcomeisnotNone |
411 | 421 | # it may be pytest.Function or _pytest.unittest.TestCaseFunction |
412 | 422 | assertisinstance(item,pytest.Function) |
413 | 423 | asserttype(call)==pytest.CallInfo# noqa: E721 |
414 | | -asserttype(outcome)==pluggy.Result# noqa: E721 |
| 424 | +asserttype(outcome)==T_PLUGGY_RESULT# noqa: E721 |
415 | 425 |
|
416 | 426 | # -------- |
417 | 427 | item_error_msg_count1=item.stash.get(g_error_msg_count_key,0) |
@@ -578,9 +588,9 @@ def pytest_runtest_makereport(item: pytest.Function, call: pytest.CallInfo): |
578 | 588 | assertisinstance(item,pytest.Function) |
579 | 589 | asserttype(call)==pytest.CallInfo# noqa: E721 |
580 | 590 |
|
581 | | -outcome:pluggy.Result=yield |
| 591 | +outcome=yield |
582 | 592 | assertoutcomeisnotNone |
583 | | -asserttype(outcome)==pluggy.Result# noqa: E721 |
| 593 | +asserttype(outcome)==T_PLUGGY_RESULT# noqa: E721 |
584 | 594 |
|
585 | 595 | asserttype(call.when)==str# noqa: E721 |
586 | 596 |
|
@@ -738,10 +748,10 @@ def pytest_pyfunc_call(pyfuncitem: pytest.Function): |
738 | 748 | assertlogWrapper._critical_counter==0 |
739 | 749 | assertlogging.root.handleislogWrapper |
740 | 750 |
|
741 | | -r:pluggy.Result=yield |
| 751 | +r=yield |
742 | 752 |
|
743 | 753 | assertrisnotNone |
744 | | -asserttype(r)==pluggy.Result# noqa: E721 |
| 754 | +asserttype(r)==T_PLUGGY_RESULT# noqa: E721 |
745 | 755 |
|
746 | 756 | assertlogWrapper._old_methodisnotNone |
747 | 757 | asserttype(logWrapper._err_counter)==int# noqa: E721 |
|