Skip to content

Instantly share code, notes, and snippets.

@maizy
Created February 19, 2013 14:00
Show Gist options
  • Save maizy/4986152 to your computer and use it in GitHub Desktop.
Save maizy/4986152 to your computer and use it in GitHub Desktop.
nosetests --with-isolations
# nosetests --with-isolation isolation.py
class T1(unittest.TestCase):
def a_test_set_global_val(self):
import math
math.abbb = 12
self.assertTrue(math.abbb == 12)
def b_test_get_global_val_in_same_testcase(self):
import math
self.assertFalse(hasattr(math, 'abbb')) # fails, AssertionError :(
class T2(unittest.TestCase):
def a_test_get_global_val_in_other_testcase(self):
import math
self.assertFalse(hasattr(math, 'abbb')) # fails, AssertionError :(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment