Last active
December 7, 2015 15:24
-
-
Save BeyondEvil/de79fe8dbd7d4d2b05af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.fixture(scope='module', autouse=True) | |
def init_test_db(request): | |
""" | |
Creates a TestDataCollection instance which houses all the data representation objects. | |
:param request: py.test request module | |
:return: TestDataCollection instance | |
""" | |
tdc = TestDataCollection() | |
request.module.tdc = tdc | |
request.addfinalizer(tdc.clear) | |
@pytest.fixture(scope='function', autouse=True) | |
def test_db(request): | |
""" | |
Attaches the TestDataCollection from init_test_db to every test instance. | |
:param request: py.test request module | |
:return: None | |
""" | |
request.instance.test_db = request.module.tdc | |
@pytest.fixture(scope='function', autouse=True) | |
def clean_test_db(request): | |
""" | |
This will clear the TestDataCollection from all objects with a ttl of 'function'. | |
:param request: py.test request module | |
:return: None | |
""" | |
tdc = request.module.tdc | |
def fin(): | |
tdc.clear(request.scope) | |
request.addfinalizer(fin) | |
## MY WAY ## | |
class TestAssignments: | |
def test_create_private_assignment_in_today(self, assignment): | |
page = PrivateAssignmentDetailsPane(self.test_driver, self.test_db) | |
## DOWWIE WAY ## | |
def test_create_private_assignment_in_today(self, test_driver, test_db, assignment): | |
page = PrivateAssignmentDetailsPane(test_driver, test_db) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment