Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New tests to replace view_test runtime: 15->0.125s #114

Closed
wants to merge 3 commits into from

Conversation

birdsarah
Copy link
Collaborator

Previously, the 8 tests in view_test were taking 12 seconds to run. By removing the dependency on the DecisionTestCase, and the user of the test client, the run time has been
dramatically reduced.

If we could do this on all the tests, the test suite would drop in run time to under 1s!!

NOTE - this includes three failing tests. One looks like a bug in the code, the other two would round out the tests but are much easier done with a small code change in views.py

Once we've code-reviewed this, we probably want to get the tests passing before we merge.

Adding a new test runner to make running tests easier. Test runner from
https://github.com/birdsarah/django-flexible-discover-runner
Would have used django-discover-runner but it didn't work with current tests,
used django-flexible-discover-runner which combines discover-runner with
django's default behavior. Run tests in exactly the same manner e.g.
./manage.py test publicweb but no longer need to import tests in __init__.py
but do need to maintain the naming convention of test files ending in _test.py
(or update the pattern in test_runner.py)
Previously, the tests were using fixtures. Switch to using factories with
the helper library factory-boy.
Previously, the 8 tests in view_test were taking 12 seconds to run. By removing
the dependency on the DecisionTestCase, and the user of the test client, the
run time has been dramatically reduced. NOTE - this includes three failing
tests. One looks like a bug in the code, the other two would round out the
tests but are much easier done with a small code change in views.py
If we could do this on all the tests, the test suite would drop in run time
to under 1s!!
def test_status_is_correctly_set_on_view_get_for_decision_list(self):
"""
It's very hard to atomically test the get method. Two options:
1) Move L146 of the get method into get_context_data (preferred)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That won't work because get_queryset uses self.status.

@jogwen
Copy link
Collaborator

jogwen commented May 10, 2013

This is a subset of #116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants