Skip to main content
Stack Overflow
  1. About
  2. For Teams
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
0 votes
0 answers
29 views

Flaky Circle CI tests (django): ImportError: cannot import name "task" from "app.tasks" (unknown location)

Sometimes, I have many flaky test failures due to one error: ImportError: cannot import name 'task_import_events_to_db' from 'app.tasks' (unknown location) It seems the tests fail because of this ...
0 votes
1 answer
40 views

Django Unit Test - using factory_boy build() on a Model with Many-To-Many relationship

I’m working on writing unit tests for a DRF project using pytest and factory_boy. I’m running into issues with many-to-many relationships. Specifically, when I try to use .build() in my unit tests, ...
1 vote
1 answer
61 views

CheckConstraint in Django model not triggering in unittest.TestCase (AssertionError: IntegrityError not raised)

I have a Model class with a series of constraints that I am attempting to test, and I am unable to get these constraints to return an IntegrityError in testing. The class is as follows: from django.db ...
0 votes
0 answers
57 views

Getting attribute error in Django BaseCommand- Check

I am working on a tutorial project. The same code works for the instructor but doesn't work for me. I have a file for custom commands: import time from psycopg2 import OperationalError as ...
0 votes
1 answer
80 views

Django Testing: Use main database as only one database available?

I am a university student, and I decided to use Django for my final year project. This means I am limited to using the University's MySQL database server. On the server, I am only allowed to have one ...
0 votes
1 answer
54 views

django.db.utils.ProgrammingError: (1146, "Table 'test_db.sensori' doesn't exist")

i have this problem when i run my testcase with django and mysql. when i run manage.py test i've got this error. Found 1 test(s). Creating test database for alias 'default'... System check identified ...
0 votes
0 answers
17 views

Django LiveServerTestCase live server shuts down prematurely

I've been trying to run some functional tests (LiveServerTestCase) with Selenium for a Django app. For demonstration it's a note taking app. When I'm trying to simulate note creation, it requires ...
0 votes
3 answers
63 views

Django test client redirects logged users to login page

I know this questions has already been asked, but none of the answers works for me. Whenever I try to use the client login in Django tests, it basically gets ignored and I get a redirect to the login ...
2 votes
2 answers
484 views

Configuring Django Testing in PyCharm

I have a simple django project that I'm making in pycharm. The directory structure is the following: zelda_botw_cooking_simulator |-- cooking_simulator_project |---- manage.py |---- ...
0 votes
0 answers
43 views

Importing login of users/tests module to another application/tests not working in Django

I'm trying to avoid code duplication so I want to import login from users/test to the ordering/test where I need to test different views that have @login_required. users/test.py User = get_user_model()...
-2 votes
1 answer
135 views

A more elegant approach to writing Django’s unit tests

I am currently writing tests using Django’s unit tests (based on Python standard library module: unittest). I have written this test for my Contact model which passes: class ContactTestCase(TestCase): ...
1 vote
1 answer
41 views

How do I pass request to a form in test

I am trying to pass request to a Django form in unittest. This is my test: def test_AddPairedStudyForm(self): self.client.force_login(self.user) request = RequestFactory().get(reverse("...
0 votes
1 answer
58 views

In python Django how to define test database and keep records inserted in test database until cleaned in tearDown method of testcase

I want a test database created for my default database in Django latest version, for that I configured in project settings.py file as below. DATABASES = { 'default': { 'ENGINE': 'django.db....
0 votes
1 answer
37 views

Defining test methods in base class which should not be instanciated directly

I am trying to create test cases which only differ by which user is logged in. Therefore I figured defining the tests in a base class and creating sub classes which log in the user during setUp() ...
1 vote
1 answer
56 views

Build a pre-decorated class with override_settings for faster client.login?

This makes a Django test using the test client run very much faster, where login security is not an important part of the test from django.test import TestCase, Client, override_settings @...

15 30 50 per page
1
2 3 4 5
...
82

AltStyle によって変換されたページ (->オリジナル) /