M
M
maxclax2015-05-04 20:26:38
Django
maxclax, 2015-05-04 20:26:38

Why is data not visible in Pytest-django?

I have a test class of tests:

class TestClass:
    @classmethod
    def setup_class(cls):
        cls.COUNT = 50
    def test_equals(self):
        assert self.COUNT == 50

when testing test_equals self.COUNT is visible. We add work with the database to the tests. (@pytest.mark.django_db):
@pytest.mark.django_db
class TestClass:
    @pytest.mark.django_db
    @classmethod
    def setup_class(cls):
        cls.COUNT = 50
    def test_equals(self):
        assert self.COUNT == 50

When testing test_equals, self.COUNT is not visible. Why is that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vinograd19, 2015-05-04
@vinograd19

According to the docs , the method should not be called setup_class but setUp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question