New submission from Peter de Blanc <pe...@standard.ai>:

According to unittest docs: 
https://docs.python.org/3.7/library/unittest.html#module-unittest

`setUpClass is called with the class as the only argument and must be decorated 
as a classmethod()`

and:

`tearDownClass is called with the class as the only argument and must be 
decorated as a classmethod()`

However, I was able to create a passing test case where `setUpClass` and 
`tearDownClass` are decorated with `@staticmethod` instead of `@classmethod`:

I tested this with Python versions 3.6.4 and 3.7.1.

Please update the documentation to indicate that `@staticmethod` is allowed 
here, or else indicate why it's bad.

----------
components: Library (Lib)
files: test_bar.py
messages: 339700
nosy: Peter de Blanc, ezio.melotti, michael.foord, rbcollins
priority: normal
severity: normal
status: open
title: @staticmethod seems to work with setUpClass, but docs say it shouldn't
type: behavior
versions: Python 3.6, Python 3.7
Added file: https://bugs.python.org/file48251/test_bar.py

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

Reply via email to