1. Christopher Grebs
  2. flask-testing

Commits

danjac  committed 9a59b0a

added module tests

  • Participants
  • Parent commits 0b35322
  • Branches alfajor-integration

Comments (0)

Files changed (1)

File tests/__init__.py

View file
  • Ignore whitespace
 def test_fixtures():
     assert fixtures.x == 10
 
+testmod = testing.register_module()
+
+@testmod.setup
+def set_y():
+    fixtures.y = 20
+
+@testmod.with_context
+def test_mod_fixtures():
+    assert fixtures.x == 10
+    assert fixtures.y == 20
+
+testmod2 = testing.register_module()
+
+@testmod2.setup
+def set_z():
+    fixtures.z = 30
+
+@testmod2.with_context
+def test_mod2_fixtures():
+    assert fixtures.x == 10
+    assert fixtures.z == 30
+    
+    try:
+        fixtures.y == 20
+        assert False, "y should not be here"
+    except AttributeError:
+        pass
 
 class TestSetup(TestCase):