Deprecate the `subsystem_instance` utility function.

Review Request #4220 - Created Sept. 10, 2016 and submitted

Information
Benjy Weinberger
pants
Reviewers
pants-reviews
jsirois, mateor, stuhood

It was implemented as a contextmanager that resets subsystem
state in __exit__. However this interacts badly with tests that
use that state (sometimes without even realizing it) outside the
subsystem_instance context. Several tests have to do weird
balancing acts to get around this.

Instead we introduce a global_subsystem_instance() that simply
inits and returns the global instance of a subsystem. Test code
can rely on our standard test base classes for cleanup between tests,
or it can reset subsystem state itself if it needs to do so mid-test.

This change allows us to remove various wrapper contextmanagers
sprinkled around our tests, and generally supports simplification
of several tests.

This is part 2 of my effort to simplify and standardize how we
create subsystems in tests. See for part 1:

44be4da8bda29e21061e550b6529a346934b9b0f

Note to reviewers: The diff is a little hairy, but the focus is on
the change in tests/python/pants_test/subsystem/subsystem_util.py.
The rest is just modifying all relevant tests to use the new method,
and the proof of the validity of those is mostly that the tests pass...

CI passes: https://travis-ci.org/pantsbuild/pants/builds/159169092

Issues

  • 0
  • 1
  • 0
  • 1
Description From Last Updated
Mateo Rodriguez
Benjy Weinberger
Stu Hood
John Sirois
Benjy Weinberger
Review request changed

Status: Closed (submitted)

Change Summary:

3b77f6b6c38fea6616cae10ca8e0c3a20782934a

Loading...