Refactor fixtures test cases
Change-Id: I6bad2e3c432732b6884e24c262b168b4d9c8021a
This commit is contained in:
parent
89122a75c6
commit
500c6f0493
@ -19,29 +19,30 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import tobiko
|
import tobiko
|
||||||
from tobiko.cmd import fixture
|
from tobiko.cmd import fixture as _fixture
|
||||||
from tobiko.tests import unit
|
from tobiko.tests import test_fixture
|
||||||
|
|
||||||
|
|
||||||
|
MyFixture = test_fixture.MyFixture
|
||||||
|
MyFixture2 = test_fixture.MyFixture2
|
||||||
|
MyRequiredFixture = test_fixture.MyRequiredFixture
|
||||||
|
canonical_name = test_fixture.canonical_name
|
||||||
|
|
||||||
|
|
||||||
class ExitCalled(Exception):
|
class ExitCalled(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MyFixture1(tobiko.SharedFixture):
|
class FixtureUtilTest(test_fixture.FixtureBaseTest):
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class MyFixture2(tobiko.SharedFixture):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class FixtureUtilTest(unit.TobikoUnitTest):
|
|
||||||
|
|
||||||
command_name = 'tobiko-fixture'
|
command_name = 'tobiko-fixture'
|
||||||
command_class = fixture.FixtureUtil
|
command_class = _fixture.FixtureUtil
|
||||||
|
|
||||||
test_path = os.path.dirname(__file__)
|
test_path = os.path.dirname(__file__)
|
||||||
top_dir = os.path.dirname(os.path.dirname(tobiko.__file__))
|
top_dir = os.path.dirname(os.path.dirname(tobiko.__file__))
|
||||||
|
|
||||||
|
required_fixture = tobiko.required_fixture(MyRequiredFixture)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(FixtureUtilTest, self).setUp()
|
super(FixtureUtilTest, self).setUp()
|
||||||
self.mock_error = self.patch('argparse.ArgumentParser.error',
|
self.mock_error = self.patch('argparse.ArgumentParser.error',
|
||||||
@ -199,43 +200,62 @@ class FixtureUtilTest(unit.TobikoUnitTest):
|
|||||||
whitelist_file=whitelist_file,
|
whitelist_file=whitelist_file,
|
||||||
black_regex=black_regex, filters=filters)
|
black_regex=black_regex, filters=filters)
|
||||||
stdout = self.patch('sys.stdout', io.StringIO())
|
stdout = self.patch('sys.stdout', io.StringIO())
|
||||||
fixture.main()
|
_fixture.main()
|
||||||
self.mock_error.assert_not_called()
|
self.mock_error.assert_not_called()
|
||||||
return stdout
|
return stdout
|
||||||
|
|
||||||
def test_list(self, fixture1=MyFixture1, fixture2=MyFixture2):
|
def test_list(self, fixture1=MyFixture, fixture2=MyFixture2):
|
||||||
stdout = self.test_main(subcommand='list')
|
stdout = self.test_main(subcommand='list')
|
||||||
written_lines = stdout.getvalue().splitlines()
|
written_lines = stdout.getvalue().splitlines()
|
||||||
self.assertIn(tobiko.get_fixture_name(fixture1), written_lines)
|
self.assertIn(canonical_name(fixture1), written_lines)
|
||||||
self.assertIn(tobiko.get_fixture_name(fixture2), written_lines)
|
self.assertIn(canonical_name(fixture2), written_lines)
|
||||||
|
self.assertIn(canonical_name(MyRequiredFixture),
|
||||||
|
written_lines)
|
||||||
|
|
||||||
def test_setup(self, fixture1=MyFixture1, fixture2=MyFixture2):
|
def test_list_with_filters(self, fixture=MyFixture):
|
||||||
setup1 = self.patch(tobiko.get_fixture_name(fixture1) + '.setUp')
|
stdout = self.test_main(subcommand='list', filters=[self.id()])
|
||||||
setup2 = self.patch(tobiko.get_fixture_name(fixture2) + '.setUp')
|
written_lines = stdout.getvalue().splitlines()
|
||||||
setup1.assert_not_called()
|
self.assertEqual([canonical_name(fixture),
|
||||||
setup2.assert_not_called()
|
canonical_name(MyRequiredFixture)],
|
||||||
|
written_lines)
|
||||||
|
self.assertIn(canonical_name(MyRequiredFixture),
|
||||||
|
written_lines)
|
||||||
|
|
||||||
|
def test_setup(self, fixture=MyFixture, fixture2=MyFixture2):
|
||||||
stdout = self.test_main(subcommand='setup')
|
stdout = self.test_main(subcommand='setup')
|
||||||
written_lines = stdout.getvalue().splitlines()
|
written_lines = stdout.getvalue().splitlines()
|
||||||
|
for obj in [fixture, fixture2, MyRequiredFixture]:
|
||||||
|
self.assertIn(canonical_name(obj), written_lines)
|
||||||
|
tobiko.get_fixture(obj).setup_fixture.assert_called_once_with()
|
||||||
|
tobiko.get_fixture(obj).cleanup_fixture.assert_not_called()
|
||||||
|
|
||||||
self.assertIn(tobiko.get_fixture_name(fixture1), written_lines)
|
def test_setup_with_filters(self, fixture=MyFixture):
|
||||||
self.assertIn(tobiko.get_fixture_name(fixture2), written_lines)
|
stdout = self.test_main(subcommand='setup', filters=[self.id()])
|
||||||
setup1.assert_called_with()
|
|
||||||
setup2.assert_called_with()
|
|
||||||
|
|
||||||
def test_cleanup(self, fixture1=MyFixture1, fixture2=MyFixture2):
|
|
||||||
cleanup1 = self.patch(tobiko.get_fixture_name(fixture1) + '.cleanUp')
|
|
||||||
cleanup2 = self.patch(tobiko.get_fixture_name(fixture2) + '.cleanUp')
|
|
||||||
cleanup1.assert_not_called()
|
|
||||||
cleanup2.assert_not_called()
|
|
||||||
|
|
||||||
stdout = self.test_main(subcommand='cleanup')
|
|
||||||
|
|
||||||
written_lines = stdout.getvalue().splitlines()
|
written_lines = stdout.getvalue().splitlines()
|
||||||
self.assertIn(tobiko.get_fixture_name(fixture1), written_lines)
|
self.assertEqual([canonical_name(fixture),
|
||||||
self.assertIn(tobiko.get_fixture_name(fixture2), written_lines)
|
canonical_name(MyRequiredFixture)],
|
||||||
cleanup1.assert_called_with()
|
written_lines)
|
||||||
cleanup2.assert_called_with()
|
for obj in [fixture, MyRequiredFixture]:
|
||||||
|
tobiko.get_fixture(obj).setup_fixture.assert_called_once_with()
|
||||||
|
tobiko.get_fixture(obj).cleanup_fixture.assert_not_called()
|
||||||
|
|
||||||
|
def test_cleanup(self, fixture=MyFixture, fixture2=MyFixture2):
|
||||||
|
stdout = self.test_main(subcommand='cleanup')
|
||||||
|
written_lines = stdout.getvalue().splitlines()
|
||||||
|
for obj in [fixture, fixture2, MyRequiredFixture]:
|
||||||
|
self.assertIn(canonical_name(obj), written_lines)
|
||||||
|
tobiko.get_fixture(obj).setup_fixture.assert_not_called()
|
||||||
|
tobiko.get_fixture(obj).cleanup_fixture.assert_called_once_with()
|
||||||
|
|
||||||
|
def test_cleanup_with_filters(self, fixture=MyFixture):
|
||||||
|
stdout = self.test_main(subcommand='cleanup', filters=[self.id()])
|
||||||
|
written_lines = stdout.getvalue().splitlines()
|
||||||
|
self.assertEqual([canonical_name(fixture),
|
||||||
|
canonical_name(MyRequiredFixture)],
|
||||||
|
written_lines)
|
||||||
|
for obj in [fixture, MyRequiredFixture]:
|
||||||
|
tobiko.get_fixture(obj).setup_fixture.assert_not_called()
|
||||||
|
tobiko.get_fixture(obj).cleanup_fixture.assert_called_once_with()
|
||||||
|
|
||||||
def setup_file_repo(self, top_dir):
|
def setup_file_repo(self, top_dir):
|
||||||
if not os.path.isdir(os.path.join(top_dir, '.stestr')):
|
if not os.path.isdir(os.path.join(top_dir, '.stestr')):
|
||||||
|
@ -13,146 +13,210 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
import tobiko
|
import tobiko
|
||||||
from tobiko.tests import unit
|
from tobiko.tests import unit
|
||||||
|
from tobiko.common import _fixture
|
||||||
|
|
||||||
|
|
||||||
class MyRequiredFixture(tobiko.SharedFixture):
|
def canonical_name(cls):
|
||||||
|
return __name__ + '.' + cls.__name__
|
||||||
|
|
||||||
|
|
||||||
|
class MyBaseFixture(tobiko.SharedFixture):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(MyRequiredFixture, self).__init__()
|
super(MyBaseFixture, self).__init__()
|
||||||
self.setup_fixture = mock.MagicMock(
|
self.setup_fixture = mock.Mock(
|
||||||
specs=tobiko.SharedFixture.setup_fixture)
|
specs=tobiko.SharedFixture.setup_fixture)
|
||||||
|
self.cleanup_fixture = mock.Mock(
|
||||||
|
|
||||||
class MyRequiredSetupFixture(tobiko.SharedFixture):
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super(MyRequiredSetupFixture, self).__init__()
|
|
||||||
self.setup_fixture = mock.MagicMock(
|
|
||||||
specs=tobiko.SharedFixture.setup_fixture)
|
|
||||||
|
|
||||||
|
|
||||||
class MyFixture(tobiko.SharedFixture):
|
|
||||||
|
|
||||||
req_fixture = tobiko.required_fixture(MyRequiredFixture)
|
|
||||||
req_setup_fixture = tobiko.required_setup_fixture(MyRequiredSetupFixture)
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super(MyFixture, self).__init__()
|
|
||||||
self.setup_fixture = mock.MagicMock(
|
|
||||||
specs=tobiko.SharedFixture.setup_fixture)
|
|
||||||
self.cleanup_fixture = mock.MagicMock(
|
|
||||||
specs=tobiko.SharedFixture.cleanup_fixture)
|
specs=tobiko.SharedFixture.cleanup_fixture)
|
||||||
|
|
||||||
|
|
||||||
MY_FIXTURE_NAME = __name__ + '.' + MyFixture.__name__
|
class MyFixture(MyBaseFixture):
|
||||||
MY_REQUIRED_FIXTURE_NAME = __name__ + '.' + MyRequiredFixture.__name__
|
pass
|
||||||
MY_REQUIRED_SETUP_FIXTURE_NAME = (
|
|
||||||
__name__ + '.' + MyRequiredSetupFixture.__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class FixtureManagerTest(unit.TobikoUnitTest):
|
class FixtureBaseTest(unit.TobikoUnitTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(FixtureManagerTest, self).setUp()
|
super(FixtureBaseTest, self).setUp()
|
||||||
tobiko.remove_fixture(MyFixture)
|
self.manager = _fixture.FixtureManager()
|
||||||
|
self.patch_object(_fixture, 'FIXTURES', self.manager)
|
||||||
|
|
||||||
def test_get_fixture_by_name(self):
|
|
||||||
self._test_get_fixture(MY_FIXTURE_NAME, fixture_type=MyFixture)
|
|
||||||
|
|
||||||
def test_get_fixture_by_type(self):
|
class GetFixtureTest(FixtureBaseTest):
|
||||||
self._test_get_fixture(MyFixture, fixture_type=MyFixture)
|
|
||||||
|
|
||||||
def _test_get_fixture(self, obj, fixture_type):
|
def test_by_name(self):
|
||||||
|
self._test_get_fixture(canonical_name(MyFixture))
|
||||||
|
|
||||||
|
def test_by_type(self):
|
||||||
|
self._test_get_fixture(MyFixture)
|
||||||
|
|
||||||
|
def _test_get_fixture(self, obj):
|
||||||
fixture = tobiko.get_fixture(obj)
|
fixture = tobiko.get_fixture(obj)
|
||||||
self.assertIsInstance(fixture, fixture_type)
|
self.assertIsInstance(fixture, MyFixture)
|
||||||
self.assertIs(fixture, tobiko.get_fixture(obj))
|
self.assertIs(fixture, tobiko.get_fixture(obj))
|
||||||
if isinstance(obj, fixtures.Fixture):
|
if isinstance(obj, fixtures.Fixture):
|
||||||
self.assertIs(obj, fixture)
|
self.assertIs(obj, fixture)
|
||||||
else:
|
else:
|
||||||
self.assertIs(fixture, tobiko.get_fixture(MY_FIXTURE_NAME))
|
self.assertIs(fixture, tobiko.get_fixture(
|
||||||
|
canonical_name(MyFixture)))
|
||||||
|
fixture.setup_fixture.assert_not_called()
|
||||||
|
fixture.cleanup_fixture.assert_not_called()
|
||||||
|
|
||||||
def test_get_fixture_by_instance(self):
|
def test_by_instance(self):
|
||||||
self._test_get_fixture(MyFixture(), fixture_type=MyFixture)
|
self._test_get_fixture(MyFixture())
|
||||||
|
|
||||||
def test_remove_fixture_by_name(self):
|
|
||||||
self._test_remove_fixture(MY_FIXTURE_NAME)
|
|
||||||
|
|
||||||
def test_remove_fixture_by_type(self):
|
class GetFixtureNameTest(FixtureBaseTest):
|
||||||
|
|
||||||
|
def test_with_instance(self):
|
||||||
|
fixture = MyFixture()
|
||||||
|
result = tobiko.get_fixture_name(fixture)
|
||||||
|
self.assertEqual(canonical_name(MyFixture), result)
|
||||||
|
|
||||||
|
|
||||||
|
class RemoveFixtureTest(FixtureBaseTest):
|
||||||
|
|
||||||
|
def test_with_name(self):
|
||||||
|
self._test_remove_fixture(canonical_name(MyFixture))
|
||||||
|
|
||||||
|
def test_with_type(self):
|
||||||
self._test_remove_fixture(MyFixture)
|
self._test_remove_fixture(MyFixture)
|
||||||
|
|
||||||
def _test_remove_fixture(self, obj):
|
def _test_remove_fixture(self, obj):
|
||||||
fixture = tobiko.get_fixture(obj)
|
fixture = tobiko.get_fixture(obj)
|
||||||
|
|
||||||
result = tobiko.remove_fixture(obj)
|
result = tobiko.remove_fixture(obj)
|
||||||
|
|
||||||
self.assertIs(fixture, result)
|
self.assertIs(fixture, result)
|
||||||
self.assertIsNot(fixture, tobiko.get_fixture(obj))
|
self.assertIsNot(fixture, tobiko.get_fixture(obj))
|
||||||
|
fixture.setup_fixture.assert_not_called()
|
||||||
|
fixture.cleanup_fixture.assert_not_called()
|
||||||
|
|
||||||
def test_get_name(self):
|
|
||||||
fixture = tobiko.get_fixture(MY_FIXTURE_NAME)
|
|
||||||
result = tobiko.get_fixture_name(fixture)
|
|
||||||
self.assertEqual(MY_FIXTURE_NAME, result)
|
|
||||||
|
|
||||||
def test_setup_fixture_by_name(self):
|
class SetupFixtureTest(FixtureBaseTest):
|
||||||
self._test_setup_fixture(MY_FIXTURE_NAME)
|
|
||||||
|
|
||||||
def test_setup_fixture_by_type(self):
|
def test_with_name(self):
|
||||||
|
self._test_setup_fixture(canonical_name(MyFixture))
|
||||||
|
|
||||||
|
def test_with_type(self):
|
||||||
self._test_setup_fixture(MyFixture)
|
self._test_setup_fixture(MyFixture)
|
||||||
|
|
||||||
def test_setup_fixture_by_instance(self):
|
def test_with_instance(self):
|
||||||
self._test_setup_fixture(MyFixture())
|
self._test_setup_fixture(MyFixture2())
|
||||||
|
|
||||||
def _test_setup_fixture(self, obj):
|
def _test_setup_fixture(self, obj):
|
||||||
result = tobiko.setup_fixture(obj)
|
result = tobiko.setup_fixture(obj)
|
||||||
self.assertIs(tobiko.get_fixture(obj), result)
|
self.assertIs(tobiko.get_fixture(obj), result)
|
||||||
result.setup_fixture.assert_called_once_with()
|
result.setup_fixture.assert_called_once_with()
|
||||||
|
result.cleanup_fixture.assert_not_called()
|
||||||
|
|
||||||
def test_cleanup_fixture_by_name(self):
|
|
||||||
self._test_cleanup_fixture(MY_FIXTURE_NAME)
|
|
||||||
|
|
||||||
def test_cleanup_fixture_by_type(self):
|
class CleanupFixtureTest(FixtureBaseTest):
|
||||||
|
|
||||||
|
def test_with_name(self):
|
||||||
|
self._test_cleanup_fixture(canonical_name(MyFixture))
|
||||||
|
|
||||||
|
def test_with_type(self):
|
||||||
self._test_cleanup_fixture(MyFixture)
|
self._test_cleanup_fixture(MyFixture)
|
||||||
|
|
||||||
def test_cleanup_fixture_by_instance(self):
|
def test_with_instance(self):
|
||||||
self._test_cleanup_fixture(MyFixture())
|
self._test_cleanup_fixture(MyFixture())
|
||||||
|
|
||||||
def _test_cleanup_fixture(self, obj):
|
def _test_cleanup_fixture(self, obj):
|
||||||
result = tobiko.cleanup_fixture(obj)
|
result = tobiko.cleanup_fixture(obj)
|
||||||
self.assertIs(tobiko.get_fixture(obj), result)
|
self.assertIs(tobiko.get_fixture(obj), result)
|
||||||
|
result.setup_fixture.assert_not_called()
|
||||||
result.cleanup_fixture.assert_called_once_with()
|
result.cleanup_fixture.assert_called_once_with()
|
||||||
|
|
||||||
def test_list_required_fixtures_from_module(self):
|
|
||||||
|
class MyFixture2(MyBaseFixture):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class MyRequiredFixture(MyBaseFixture):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class MyRequiredSetupFixture(MyBaseFixture):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ListRequiredFixtureTest(FixtureBaseTest):
|
||||||
|
|
||||||
|
required_fixture = tobiko.required_fixture(MyRequiredFixture)
|
||||||
|
required_setup_fixture = tobiko.required_setup_fixture(
|
||||||
|
MyRequiredSetupFixture)
|
||||||
|
|
||||||
|
def test_with_module(self):
|
||||||
|
module = sys.modules[__name__]
|
||||||
|
result = tobiko.list_required_fixtures([module])
|
||||||
|
self.assertEqual([], result)
|
||||||
|
|
||||||
|
def test_with_module_name(self):
|
||||||
result = tobiko.list_required_fixtures([__name__])
|
result = tobiko.list_required_fixtures([__name__])
|
||||||
self.assertEqual([], result)
|
self.assertEqual([], result)
|
||||||
|
|
||||||
def test_list_required_fixtures_from_testcase_type(self):
|
def test_with_testcase_type(self):
|
||||||
result = tobiko.list_required_fixtures([FixtureManagerTest])
|
result = tobiko.list_required_fixtures([ListRequiredFixtureTest])
|
||||||
self.assertEqual([], result)
|
self.assertEqual([canonical_name(MyRequiredFixture),
|
||||||
|
canonical_name(MyRequiredSetupFixture)], result)
|
||||||
|
|
||||||
def test_list_required_fixtures_from_fixture_type(self):
|
def test_with_testcase_name(self):
|
||||||
result = tobiko.list_required_fixtures([MyFixture])
|
result = tobiko.list_required_fixtures(
|
||||||
self.assertEqual([MY_FIXTURE_NAME], result)
|
[canonical_name(ListRequiredFixtureTest)])
|
||||||
|
self.assertEqual([canonical_name(MyRequiredFixture),
|
||||||
|
canonical_name(MyRequiredSetupFixture)], result)
|
||||||
|
|
||||||
def test_list_required_fixtures_from_fixture_name(self):
|
def test_with_unbound_method(self, fixture=MyFixture, fixture2=MyFixture2):
|
||||||
result = tobiko.list_required_fixtures([MY_FIXTURE_NAME])
|
result = tobiko.list_required_fixtures(
|
||||||
self.assertEqual([MY_FIXTURE_NAME], result)
|
[ListRequiredFixtureTest.test_with_unbound_method])
|
||||||
|
self.assertEqual([canonical_name(fixture),
|
||||||
|
canonical_name(fixture2),
|
||||||
|
canonical_name(MyRequiredFixture),
|
||||||
|
canonical_name(MyRequiredSetupFixture)], result)
|
||||||
|
|
||||||
def test_list_required_fixtures_from_method(
|
def test_with_bound_method(self, fixture=MyFixture, fixture2=MyFixture2):
|
||||||
self, fixture_type=MyFixture):
|
result = tobiko.list_required_fixtures([self.test_with_bound_method])
|
||||||
|
self.assertEqual([canonical_name(fixture),
|
||||||
|
canonical_name(fixture2),
|
||||||
|
canonical_name(MyRequiredFixture),
|
||||||
|
canonical_name(MyRequiredSetupFixture)], result)
|
||||||
|
|
||||||
|
def test_with_method_name(self, fixture=MyFixture, fixture2=MyFixture2):
|
||||||
result = tobiko.list_required_fixtures([self.id()])
|
result = tobiko.list_required_fixtures([self.id()])
|
||||||
self.assertEqual([MY_FIXTURE_NAME], result)
|
self.assertEqual([canonical_name(fixture),
|
||||||
self.assertIsInstance(tobiko.get_fixture(MY_FIXTURE_NAME),
|
canonical_name(fixture2),
|
||||||
fixture_type)
|
canonical_name(MyRequiredFixture),
|
||||||
|
canonical_name(MyRequiredSetupFixture)], result)
|
||||||
|
|
||||||
def test_list_required_fixtures_from_fixture_object(self):
|
def test_with_fixture_name(self):
|
||||||
fixture = tobiko.get_fixture(MY_FIXTURE_NAME)
|
result = tobiko.list_required_fixtures([canonical_name(MyFixture)])
|
||||||
result = tobiko.list_required_fixtures([fixture])
|
self.assertEqual([canonical_name(MyFixture)], result)
|
||||||
self.assertEqual([MY_FIXTURE_NAME], result)
|
|
||||||
|
def test_with_fixture(self):
|
||||||
|
result = tobiko.list_required_fixtures([MyFixture()])
|
||||||
|
self.assertEqual([canonical_name(MyFixture)], result)
|
||||||
|
|
||||||
|
def test_with_fixture_type(self):
|
||||||
|
result = tobiko.list_required_fixtures([MyFixture])
|
||||||
|
self.assertEqual([canonical_name(MyFixture)], result)
|
||||||
|
|
||||||
|
def test_required_fixture_property(self):
|
||||||
|
fixture = self.required_fixture
|
||||||
|
self.assertIsInstance(fixture, MyRequiredFixture)
|
||||||
|
fixture.setup_fixture.assert_not_called()
|
||||||
|
fixture.cleanup_fixture.assert_not_called()
|
||||||
|
|
||||||
|
def test_required_setup_fixture_property(self):
|
||||||
|
fixture = self.required_setup_fixture
|
||||||
|
self.assertIsInstance(fixture, MyRequiredSetupFixture)
|
||||||
|
fixture.setup_fixture.assert_called_once_with()
|
||||||
|
fixture.cleanup_fixture.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
class SharedFixtureTest(unit.TobikoUnitTest):
|
class SharedFixtureTest(unit.TobikoUnitTest):
|
||||||
@ -165,9 +229,6 @@ class SharedFixtureTest(unit.TobikoUnitTest):
|
|||||||
fixture = MyFixture()
|
fixture = MyFixture()
|
||||||
fixture.setup_fixture.assert_not_called()
|
fixture.setup_fixture.assert_not_called()
|
||||||
fixture.cleanup_fixture.assert_not_called()
|
fixture.cleanup_fixture.assert_not_called()
|
||||||
self.assertIs(tobiko.get_fixture(MyRequiredFixture),
|
|
||||||
fixture.req_fixture)
|
|
||||||
fixture.req_setup_fixture.setup_fixture.assert_called_once()
|
|
||||||
|
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
fixture = MyFixture.get()
|
fixture = MyFixture.get()
|
||||||
|
Loading…
Reference in New Issue
Block a user