def test_popping_unpopulated_override_errors(self): manager = OverrideManager() with pytest.raises(RuntimeError) as excinfo: manager.pop() assert "popped wrong override context" in str(excinfo.value)
def test_current_overrides_returns_active_context(self, never): manager = OverrideManager() o = Override(never) manager.push(o) assert o == current_overrides manager.pop()
def test_manager_throws_if_different_context_popped(self): manager = OverrideManager() manager.push(Override()) manager2 = OverrideManager() with pytest.raises(RuntimeError) as excinfo: manager2.pop() assert "popped wrong override context" in str(excinfo.value)
def test_conditional_skips_overridden_requirements(member, never, always, request): manager = OverrideManager() manager.push(Override(never)) reqs = And(never, always) assert reqs.fulfill(member, request) manager.pop()
def test_current_overrides_points_towards_temporary_context( self, never, always): manager = OverrideManager() manager.push(Override(never)) o = Override(always) with manager.override(o): assert o == current_overrides manager.pop()
def test_conditional_skips_overridden_requirements_even_if_nested( member, always, never, request ): manager = OverrideManager() manager.push(Override(never)) reqs = And(And(And(always), Or(never))) assert reqs.fulfill(member) manager.pop()