File tree Expand file tree Collapse file tree 2 files changed +13
-18
lines changed Expand file tree Collapse file tree 2 files changed +13
-18
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ Charles Machalow
62
62
Charnjit SiNGH (CCSJ)
63
63
Chris Lamb
64
64
Chris NeJame
65
+ Chris Rose
65
66
Christian Boelsen
66
67
Christian Fetzer
67
68
Christian Neumüller
Original file line number Diff line number Diff line change @@ -169,40 +169,34 @@ This is outlined below:
169
169
170
170
# content of test_class_demo.py
171
171
class TestClassDemoInstance :
172
+ value = 0
173
+
172
174
def test_one (self ):
173
- assert 0
175
+ self .value = 1
176
+ assert self .value == 1
174
177
175
178
def test_two (self ):
176
- assert 0
179
+ assert self .value == 1
177
180
178
181
179
182
.. code-block :: pytest
180
183
181
184
$ pytest -k TestClassDemoInstance -q
182
- FF [100%]
185
+ .F [100%]
183
186
================================= FAILURES =================================
184
- ______________________ TestClassDemoInstance.test_one ______________________
185
-
186
- self = <test_class_demo.TestClassDemoInstance object at 0xdeadbeef>
187
-
188
- def test_one(self):
189
- > assert 0
190
- E assert 0
191
-
192
- test_class_demo.py:3: AssertionError
193
187
______________________ TestClassDemoInstance.test_two ______________________
194
188
195
189
self = <test_class_demo.TestClassDemoInstance object at 0xdeadbeef>
196
190
197
191
def test_two(self):
198
- > assert 0
199
- E assert 0
192
+ > assert self.value == 1
193
+ E assert 0 == 1
194
+ E + where 0 = <test_class_demo.TestClassDemoInstance object at 0xdeadbeef>.value
200
195
201
- test_class_demo.py:6 : AssertionError
196
+ test_class_demo.py:9 : AssertionError
202
197
========================= short test summary info ==========================
203
- FAILED test_class_demo.py::TestClassDemoInstance::test_one - assert 0
204
- FAILED test_class_demo.py::TestClassDemoInstance::test_two - assert 0
205
- 2 failed in 0.12s
198
+ FAILED test_class_demo.py::TestClassDemoInstance::test_two - assert 0 == 1
199
+ 1 failed, 1 passed in 0.04s
206
200
207
201
Note that attributes added at class level are *class attributes *, so they will be shared between tests.
208
202
You can’t perform that action at this time.
0 commit comments