Skip to content

Commit

Permalink
Test to verify safe current_context behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
rhettg committed Nov 16, 2015
1 parent 88642a9 commit 6f5be1a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/context_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,20 @@ def test(self):
blueox.clear_contexts()

assert_equal(blueox.current_context(), None)


class BrokenCurrentContextTestCase(TestCase):
@setup
def broken_context(self):
c = blueox.Context('test')
assert not c.writable
blueox.context._add_context(c)

@teardown
def clear(self):
blueox.clear_contexts()

def test(self):
# Non-writable context shouldn't show up.
current_c = blueox.current_context()
assert not current_c

0 comments on commit 6f5be1a

Please sign in to comment.