From fbbf7f90f63c308a7869879d367da3b714b8d288 Mon Sep 17 00:00:00 2001 From: Charles Hendrie Date: Tue, 27 Sep 2016 15:01:37 -0500 Subject: [PATCH] Fix test certificates module hanging issue (#427) * Fix test certificates module hanging issue When executing the lemur/tests/test_certificates.py module's tests, all tests are executed, but the test process appears to hang and never completes with the display of the results for the tests. The hanging issue is traced to the two test methods: test_import(logged_in_user) and test_upload(logged_in_user). The issue has to do with the test methods' using the logged_in_user(app) fixture from the conftest.py module as the method parameter. The test methods at issue require the session, db, and app fixtures to be initialized for the tests to complete successfully. The logged_in_user() fixture only initializes the app fixture. Updating the test_import() and test_upload() methods parameters to be the "session" fixture fixes the hanging issue and the tests complete successfully. This is the command being used to execute the tests... $ py.test -s -v lemur/tests/test_certificates.py * Update fix for test certificates hanging issue Based on feedback from the original pull request for this fix, added the session fixture to the logged_in_user fixture and reverted the test_import() and test_upload() methods to use the logged_in_user (instead of the session fixture). --- lemur/tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lemur/tests/conftest.py b/lemur/tests/conftest.py index 3fe321f4..eb9d7491 100644 --- a/lemur/tests/conftest.py +++ b/lemur/tests/conftest.py @@ -141,7 +141,7 @@ def issuer_plugin(): @pytest.yield_fixture(scope="function") -def logged_in_user(app): +def logged_in_user(session, app): with app.test_request_context(): identity_changed.send(current_app._get_current_object(), identity=Identity(1)) yield