Skip to content

Colissions with mock for open builtins in 1.1.3 #280

@andreykurilin

Description

@andreykurilin

We have a base TestCase with simple test and one inheritor(see below). When inheritor and TestCase are launched by one worker, the mock_open is getting torn down after it's first use, and not correctly built again(returns empty string) on subsequent calls.

import mock import six import testtools class TestCase(testtools.TestCase): @mock.patch.object(six.moves.builtins, 'open', mock.mock_open(read_data='FAKE_DATA')) def test_check_open(self): with open("some") as f: self.assertEqual('FAKE_DATA', f.read()) class AnotherTestCase(TestCase): pass 

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