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

Mock django db #23

Merged
merged 5 commits into from
Dec 15, 2016
Merged

Mock django db #23

merged 5 commits into from
Dec 15, 2016

Conversation

donkirkby
Copy link
Collaborator

@donkirkby donkirkby commented Dec 14, 2016

Recreating pull request #20 after it got rebasted.

Remaining work:

  • Move stuff from utils to a separate mocks.py module.
  • Delete mock_setup.py from example.
  • Clarify docs on monkey_patch_test_db(), and how it's used in example, including @skipIfDBFeature('is_mocked') decorator.
  • Test it with pytest-django.
  • Document all three Django helpers in source code to describe when they are used.

Update example Django project to show how to run mock tests without a database.
Configure tox to execute Django tests and mock tests from the example project.

(cherry picked from commit 262f488)
Makes it easier to configure tests on a Django project.

(cherry picked from commit e495f62)
@codecov-io
Copy link

codecov-io commented Dec 14, 2016

Current coverage is 100% (diff: 100%)

Merging #23 into master will not change coverage

@@           master   #23   diff @@
===================================
  Files           5     6     +1   
  Lines         307   346    +39   
  Methods         0     0          
  Messages        0     0          
  Branches        0     0          
===================================
+ Hits          307   346    +39   
  Misses          0     0          
  Partials        0     0          

Powered by Codecov. Last update 68026f4...74bc14e

@donkirkby
Copy link
Collaborator Author

OK, this is ready for merging, I think.

Feel free to comment out the pytest runs in tox.ini, if you think it's too much. However, I added them when I realized that I had broken the example project for pytest by moving test_api.py and test_views.py into the Django default of tests.py. It seems like it's too easy to break stuff if you don't actually run it.

Because I added a requirement for pytest-django, you'll need to run tox --recreate the first time.

@stphivos
Copy link
Owner

Cool thanks it looks good! Yeah let's keep the additional runs in tox.ini. 👍

@stphivos stphivos merged commit cdd9b04 into stphivos:master Dec 15, 2016
@donkirkby donkirkby deleted the mock-django-db branch December 15, 2016 17:07
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.

3 participants