The compromise, using the patch as currently written [1], would entail adding one line at the top of each test file:
uuids = uuidsentinel.UUIDSentinels() ...as seen (more or less) at [2]. The subtle difference being that this `uuids` wouldn't share a namespace across the whole process, only within that file. Given current usage, that shouldn't cause a problem, but it's a change. -efried [1] https://review.openstack.org/#/c/594068/9 [2] https://review.openstack.org/#/c/594068/9/oslotest/tests/unit/test_uuidsentinel.py@22 On 08/23/2018 12:41 PM, Jay Pipes wrote: > On 08/23/2018 01:25 PM, Doug Hellmann wrote: >> Excerpts from Eric Fried's message of 2018-08-23 09:51:21 -0500: >>> Do you mean an actual fixture, that would be used like: >>> >>> class MyTestCase(testtools.TestCase): >>> def setUp(self): >>> self.uuids = >>> self.useFixture(oslofx.UUIDSentinelFixture()).uuids >>> >>> def test_foo(self): >>> do_a_thing_with(self.uuids.foo) >>> >>> ? >>> >>> That's... okay I guess, but the refactoring necessary to cut over to it >>> will now entail adding 'self.' to every reference. Is there any way >>> around that? >> >> That is what I had envisioned, yes. In the absence of a global, >> which we do not want, what other API would you propose? > > As dansmith mentioned, the niceness and simplicity of being able to do: > > import nova.tests.uuidsentinel as uuids > > .. > > def test_something(self): > my_uuid = uuids.instance1 > > is remarkably powerful and is something I would want to keep. > > Best, > -jay > > __________________________________________________________________________ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev __________________________________________________________________________ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev