Lessons about Tests (page 3)
The links, tools and tips our engineers and designers share with each other, one “today I learned” at a time.
- lessons shared
- 44
- people sharing
- 16
- database started in
- 2016










Tech Insights· realpython.com
How to write automated tests in Django [Django]
Shared by
Read on realpython.com- Django
- Tests
Today I learned
To avoid a FileField with a custom storage using AWS S3 (django-storages) to try authenticating when model is saved you can ...
To avoid a FileField with a custom storage using AWS S3 (django-storages) to try authenticating when model is saved you can patch the save method of the instance of the storage. Eg.: python class MyTest(TestCase): @mock.patch('my_app.models.my_s3_boto_storage_instance.save') def test_create_my_model(self, save): pass # test model creation
Hugo Bessa
Tech Insights
To avoid a FileField with a custom storage using AWS S3 (django-storages) to try authenticating when model is saved you can ...
To avoid a FileField with a custom storage using AWS S3 (django-storages) to try authenticating when model is saved you can patch the save method of the instance of the storage. Eg.:
python class MyTest(TestCase): @mock.patch('my_app.models.my_s3_boto_storage_instance.save') def test_create_my_model(self, save): pass # test model creationShared by
- Aws S3
- Django
- Django Storages
- Mock
- Tests


Tech Insights· github.com
Django test utils to manage file storage side effects:
Shared by
Read on github.com- Django
- Tests
stackoverflow.com
Solution for slow Django tests with custom localhost domain: #comment81243303_28864152
Flávio Juvenal
Tech Insights· stackoverflow.com
Solution for slow Django tests with custom localhost domain: #comment81243303_28864152
Shared by
Read on stackoverflow.com- Django
- Tests

caktusgroup.com
DRYer Django test code with subtests
Using subtests can help Python developers write cleaner code. Find out how.
Flávio Juvenal

Tech Insights· caktusgroup.com
DRYer Django test code with subtests
From caktusgroup.com
Using subtests can help Python developers write cleaner code. Find out how.
Shared by
Read on caktusgroup.com- Django
- Dry
- Python
- Test
- Tests


Tech Insights· pypi.python.org
Python mutation testing library:
Shared by
Read on pypi.python.org- Python
- Tests
Today I learned
Be careful when comparing
Decimalandfloat:Decimal('3.0') == 3.0butDecimal('3.2') != 3.2.Filipe Ximenes
Tech Insights
Be careful when comparing
Decimalandfloat:Decimal('3.0') == 3.0butDecimal('3.2') != 3.2.Shared by
- Python
- Tests
Today I learned
This is how you mock components when testing react with
jest:// in your test file jest.mock('../path/to/component/to/Component.js'); Create a __mocks__ folder in the same directory of the component you want to test and a file with the same name of the component inside it: // __mocks__/Component.js import React from 'react'; export default function mock() { return (<span>Component mock</span>); }
Filipe Ximenes
Tech Insights
This is how you mock components when testing react with
jest:// in your test file jest.mock('../path/to/component/to/Component.js');Create a
__mocks__folder in the same directory of the component you want to test and a file with the same name of the component inside it:// __mocks__/Component.js import React from 'react'; export default function mock() { return (<span>Component mock</span>); }Shared by
- Tests
Today I learned
Speed up your Django automated tests with
python manage.py test --keepdb --parallelFlávio Juvenal
Tech Insights
Speed up your Django automated tests with
python manage.py test --keepdb --parallelShared by
- Django
- Tests

bit.ly
Testing image upload in Django Rest Framework:
Django REST Framework - Testing image upload. GitHub Gist: instantly share code, notes, and snippets.
Victor Carriço

Tech Insights· bit.ly
Testing image upload in Django Rest Framework:
From bit.ly
Django REST Framework - Testing image upload. GitHub Gist: instantly share code, notes, and snippets.
Shared by
Read on bit.ly- Django
- Django Rest Framework
- Tests
Today I learned
This is how to pass an argument to a
Makefilecommand:ARG := $(word 2, $(MAKECMDGOALS) ) test: python manage.py test $(ARG) --parallel --keepdb Use like this: make test app.tests
Filipe Ximenes
Tech Insights
This is how to pass an argument to a
Makefilecommand:ARG := $(word 2, $(MAKECMDGOALS) ) test: python manage.py test $(ARG) --parallel --keepdbUse like this:make test app.testsShared by
- Tests
- Link offline
circleci.com · offline
Use
jest --runInBandfor faster builds and to avoid out of memory errors in [CircleCI](André Ericson
Link offlineTech Insights· circleci.com
Use
jest --runInBandfor faster builds and to avoid out of memory errors in [CircleCI](Shared by
The original link on circleci.com is no longer available.
Look for it on the Wayback Machine- Tests
Tech Insights
While developing, do
python manage.py --keepdbto speed up your Django tests. This prevents the overhead of creating and destroying a new test DBShared by
- Django
- Tests

hackernoon.com
Use
subTestin Python unittest when asserting inside loop: [#.425k66c9b](#.425k66c9b)Use subTest in Python unittest when asserting inside loop: #.425k66c9b
Filipe Ximenes

Tech Insights· hackernoon.com
Use
subTestin Python unittest when asserting inside loop: [#.425k66c9b](#.425k66c9b)Use
subTestin Python unittest when asserting inside loop: #.425k66c9bShared by
Read on hackernoon.com- Django
- Tests
Book a call
Found it useful?
Let’s put it to work.
Tell us about your product and the problem in front of you. We’ll bring what we’ve learned on real projects.
Tell us about your product, and we’ll bring what we’ve learned.
Still prefer the good old email? Contact us



