Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

Thank you Nikita.

The difference between the original and the proposed in PR 28060 code is that 
in the original code the conditional was tested at the testing time, while in 
the proposed code it is tested at the loading time. I do not know what effect  
it causes on tests. If it does not matter, the code can be simpler:

   return unittest.skipIf(should_be_skipped,
                          f"hash digest '{digestname}' is not available.")

But if it matters, there are two options:

1. In requires_hashdigest() raise exception if func is a class. Remove the 
decorator from classes and add it to test and setup methods or just to the 
setUpClass() classmethod.

2. In requires_hashdigest() check if func is a class, and if it is true, patch 
its test and setup methods (or just add a decorated setUpClass() classmethod).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45042>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to