()
| 77 | |
| 78 | |
| 79 | def test_diehard(): |
| 80 | @library.python.windows.diehard(library.python.windows.ERRORS['ACCESS_DENIED'], tries=5) |
| 81 | def erroneous_func(errors): |
| 82 | try: |
| 83 | gen_error_access_denied() |
| 84 | except Exception as e: |
| 85 | errors.append(e) |
| 86 | raise |
| 87 | |
| 88 | raised_errors = [] |
| 89 | with pytest.raises(OSError) as errinfo: |
| 90 | erroneous_func(raised_errors) |
| 91 | assert errinfo.value.errno == errno.EACCES |
| 92 | assert any(e.errno == errno.EACCES for e in raised_errors) |
| 93 | assert raised_errors and errinfo.value == raised_errors[-1] |
| 94 | if library.python.windows.on_win(): |
| 95 | assert len(raised_errors) == 5 |
| 96 | else: |
| 97 | assert len(raised_errors) == 1 |
nothing calls this directly
no test coverage detected