All Questions
37
questions
1
vote
1
answer
69
views
What type of tests should I use for writing a test with TDD?
I come from a PHP (Laravel) background and have just switched to Python. I am a big fan of TDD and have previously been writing 'feature' tests. Now I am writing AWS Lambdas (which are making lots of ...
1
vote
1
answer
2k
views
pytest mark parametrize a fixture
I want to test a function get_xyz(a, b, foo), where foo is a class. A foo_fixture is defined in a conftest.py like so:
@pytest.fixture()
def foo_fixture():
return Foo()
The fixture simply returns ...
0
votes
1
answer
121
views
Mocking calls to super class in python through
I am trying to mock the super class of a class with a setup similar to this:
File parent.py
class Parent:
def write(self):
*some code*
File child.py
class Child(Parent):
def write(...
1
vote
1
answer
185
views
Select different dataset when testing | Separate test from production
This question is partly about how to test external dependencies (a.k.a. integration tests) and partly how to implement it with Python for SQL with BigQuery in specific. So answers only about 'This is ...
0
votes
2
answers
378
views
Error when reverse url with multiple arguments - Django
I'm writing a test for an url, problem is it fails when I try to pass multiple arguments, here is some code:
#test_urls.py
from django.test import SimpleTestCase
from django.urls import reverse, ...
0
votes
0
answers
705
views
django test client CRUD API, unit testing
I want to write pure unit tests for my CRUD APP in django.
Everyone use django tests or pytests, but I am really confused. Should I use test client to testing eg. POST method?
Unit tests should be ...
1
vote
1
answer
630
views
Django.core.exceptions.ImproperlyConfigured: Error running functional_tests.py
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings....
0
votes
2
answers
57
views
Testing Unit's Efficiency in TDD
Let's say we need a sort function and want to ensure that it is implemented in O(nlogn) rather than O(n^2).
Using test driven development, is there a systematic way to test the efficiency of ...
2
votes
2
answers
398
views
Test Driven Development with Django
I have a conceptual question about doing test driven development with Django, may also apply to other frameworks as well.
TDD states that the firts step in the development cycle is to write failing ...
0
votes
1
answer
100
views
should test static text for tdd for example email subject?
I'm not sure if should test static text for TDD for example email subject
for example I have the next piece of code is necessary add a test for including proper subject? or proper "from" param?
def ...
3
votes
3
answers
173
views
Starting TDD halfway a project, good practice?
I am halfway in the development of a large Flask web application.
Back in the beginning I chose not to use test-driven-development, for learning curve vs project deadline reasons.
Thus these last ...
2
votes
1
answer
892
views
assert vs == for testing code in Python?
What is the need for importing unittest and running assertTrue (for example) while testing a python function instead of writing a usual python function with == True check for testing? What is the new ...
1
vote
0
answers
173
views
ask about "test driven development with python" chapter 5
page 63 ~ 66
I run the code
python manage.py test
the error message is
Creating test database for alias 'default'...
FF.
======================================================================
FAIL:...
46
votes
4
answers
19k
views
Is there a python equivalent for RSpec to do TDD?
I'm looking for a test framework like Ruby's RSpec to do test driven development in Python. The advantage of a framework like RSpec is that it offers a DSL that lends itself well to TDD. First you ...
0
votes
1
answer
449
views
Could you explain Test Driven Development using my specific example? [closed]
I am trying to understand Test Driven Development, but still do not get it.
Let's imagine, that we need to write a function, that returns power of a number.
def power_of_a_number ( number, power ):
....