Skip to content

invoke setUpClass() many times under running multiple cpu mode #15

Closed
@heipark

Description

@heipark

os: win7
py:2.7 && pytest (2.8.2) && pytest-xdist (1.13.1)

import unittest

class SomeTest(unittest.TestCase):

    def test_unit1(self):
        pass

    def test_unit2(self):
        pass

    def test_unit3(self):
        pass

    def test_unit4(self):
        pass                        

    def test_unit4(self):
        pass         

    def test_unit5(self):
        pass     

    @classmethod
    def setUpClass(cls):
        with open('c:/abc.txt', 'a') as f :
            f.write('######\n')

command:

py.test testme.py   -v -n 3

content of c:/abc.txt:

######
######
######

xdist can not guarantee setUpClass() only run once ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions