M
M
maxclax2015-04-25 12:12:17
Django
maxclax, 2015-04-25 12:12:17

What data visibility when testing through Py.test?

I'm testing a django project using the calling method:

@classmethod
    def setUpClass(cls):
        cls.COUNT = 50
        NewsFactory.create_batch(is_allowed=True, size=cls.COUNT)

it is automatically called once before running the tests in the class. At the same time, the cls.COUNT variable is available in all tests of this class through self.
Studying py.test faced the following problem.
@classmethod
    def setup_class(cls):
        cls.COUNT = 50
        NewsFactory.create_batch(is_allowed=True, size=cls.COUNT)

the essence is the same. But in all tests of this class it is not visible through self cls.COUNT and the records created by NewsFactory.create_batch(is_allowed=True, size=cls.COUNT) are not visible by itself. Why is that? Perhaps I'm testing with py.test using a different approach to solving this problem.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question