Deprecate the `subsystem_instance` utility function.

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

Benjy Weinberger
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:


Note to reviewers: The diff is a little hairy, but the focus is on
the change in tests/python/pants_test/subsystem/
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:


  • 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: