Title: unittest setUpClass missing 1 required positional argument: 'cls'
Type: Stage: resolved
Components: Tests Versions: Python 3.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: dizcza, zach.ware
Priority: normal Keywords:

Created on 2019-10-11 21:28 by dizcza, last changed 2019-10-12 08:09 by dizcza. This issue is now closed.

Messages (3)
msg354501 - (view) Author: Danylo (dizcza) Date: 2019-10-11 21:28
Currently, unittest setUpClass and tearDownClass methods are incorrectly called from within its core.

class TestUltrasonicEnv(unittest.TestCase):

    def setUpClass(cls):

    def tearDownClass(cls):

Traceback (the same for teadDownClass)
  File "/home/dizcza/anaconda3/envs/robotsim/lib/python3.7/unittest/", line 163, in _handleClassSetUp
TypeError: setUpClass() missing 1 required positional argument: 'cls'

The traceback is self-descriptive.
msg354506 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2019-10-11 21:53
`setUpClass` and `tearDownClass` are classmethods and must be decorated as such (`@classmethod`).
msg354525 - (view) Author: Danylo (dizcza) Date: 2019-10-12 08:09
Sorry, true.
You can close the issue.
Date User Action Args
2019-10-12 08:09:36dizczasetstatus: pending -> closed

messages: + msg354525
stage: resolved
2019-10-11 21:53:36zach.waresetstatus: open -> pending

nosy: + zach.ware
messages: + msg354506

resolution: not a bug
2019-10-11 21:28:59dizczacreate